RavishaHesh / PDFJsAnnotations

Wrapper for PDF JS to add annotations
MIT License
322 stars 98 forks source link

Adding undo feature and Add text doesn't work in iPad #46

Open netmastan opened 2 years ago

netmastan commented 2 years ago

Hi, is it possible to add undo feature? It will be a great add-on.

And also I noticed Add text doesn't work on iPad.

Thanks for your great tool

RavishaHesh commented 2 years ago

It's possible to add undo/redo feature by storing all elements in an array. I'll try to add it. I'll look into the iPad issue as well.

netmastan commented 2 years ago

Thank you, Sir. If you click outside the canvas area(close to any edges) you get the text box but when you click on the canvas you don't the text box. You get the error "Intervention] Ignored attempt to cancel a touch start event with cancelable=false, for example, because scrolling is in progress and cannot be interrupted."

You can't also touch the canvas to pull up and down on iPad and iPhone. You can replicate this in-browser using Developer tool -> Device tool bar-> switching iPad or other devices.

jesesqui commented 2 years ago

It is possible that the button to add text works like the one to add rectangle, since it does not work for me on iPad either.

Thanks for your great tool (x2)

jesesqui commented 2 years ago

I force scroll like this:

div id="pdf-container" class="scroll"></div css

.scroll { width: 1000px; height: 1200px; background-color: #ccc; overflow-y: scroll; margin-left: auto; margin-right: auto; }

js $(".scroll").hover(function() { var oldScrollPos = $(window).scrollTop();

$(window).on('scroll.scrolldisabler', function(event) { $(window).scrollTop(oldScrollPos); event.preventDefault(); }); }, function() { $(window).off('scroll.scrolldisabler'); });

jesesqui commented 2 years ago

I changed this functions lines in fabric.min.js

line 4792 function() { var r = fabric.util.addListener, n = fabric.util.removeListener, s = { passive: !0 /de 1 a 0/ };

line 4907 _onTouchStart: function(t) { //t.preventDefault(), /disable/

line 4950 _onMouseMove: function(t) { //!this.allowTouchScrolling && t.preventDefault && t.preventDefault(), /disable/

and works in mode touch in Chrome.

jesesqui commented 2 years ago

its posible add placerholder to itextboxs generated

RavishaHesh commented 2 years ago

its posible add placerholder to itextboxs generated

Placeholder means? A default value?

jesesqui commented 2 years ago

the text which show before starting write and hide when write something. The short hint is displayed in the input field before the user enters a value. like this image.

Captura de Pantalla 2021-11-24 a la(s) 9 46 43
janlord01 commented 2 years ago

any update on this? Thanks

RavishaHesh commented 2 years ago

any update on this? Thanks

I don't see any options in fabric.js itself to provide placeholders http://fabricjs.com/docs/fabric.Textbox.html#Textbox but this might be able to implement using a custom click handler. But since it has resize handlers click handler might override that function