Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iPad compatibility #1

Closed
danamajid opened this issue Sep 8, 2011 · 9 comments
Closed

iPad compatibility #1

danamajid opened this issue Sep 8, 2011 · 9 comments

Comments

@danamajid
Copy link

How can one make this great plugin work properly on the iPad? It almost works perfectly, but the problem is that once you draw a line and do mouseUp, and you want to draw some more, it does that but it erases everything around the new line you are drawing. Seems like there is a white background on the ipad when someone draws.

@leonth
Copy link

leonth commented Sep 11, 2011

Hi @dandoen, I came across the same problem and managed to get a workaround. The problem is that somehow iPad did not fire the touchend / touchcancel events properly, so @stopPainting is never called. For the workaround add @stopPainting if @painting before @startPainting at line 185.

I actually added this in the generated javascript, since I'm not really well versed in coffescript:

--- sketch-orig.js  2011-09-11 20:35:08.924501497 +0800
+++ sketch.js   2011-09-11 21:20:16.333971939 +0800
@@ -128,6 +128,9 @@
       switch (e.type) {
         case 'mousedown':
         case 'touchstart':
+          if (this.painting) {
+            this.stopPainting();
+          }
           this.startPainting();
           break;
         case 'mouseup':
@@ -176,4 +179,4 @@
       return this.context.globalCompositeOperation = oldcomposite;
     }
   };
-})(jQuery);
\ No newline at end of file
+})(jQuery);

Let me know if this works for you.

@danamajid
Copy link
Author

@leonth, this worked for me! Thanks so much.

@mstanton
Copy link

mstanton commented Nov 2, 2013

You have saved me hours of debugging, and my Friday night. Thank you!

@husni
Copy link

husni commented Jan 21, 2014

you saved my life 👯 thanks!!!

@pmaoui
Copy link

pmaoui commented Mar 26, 2014

As this project seems to be inactive, I have created a fork with this fix here :
https://github.com/poupougnac/sketch.js

@JeremyKirkham
Copy link

However if you then clear the canvas using canvas.sketch().actions = []; and then start writing on the canvas again, it will also draw the last saved line. You will also need to call canvas.sketch().action = []

@james-tw
Copy link

What worked for me in the end was calling canvas.sketch().action = null; instead of canvas.sketch().action = []; The latter was working to clear things but breaking my app.

@sferoze
Copy link

sferoze commented Aug 30, 2014

@poupougnac The fix worked great thanks for the script!

briannielson added a commit to briannielson/beratemyelephant that referenced this issue Nov 19, 2015
Using Sketch.js from:

https://github.com/intridea/sketch.js -- base
mobomo/sketch.js#1 -- using fix available here
@WooMan
Copy link

WooMan commented May 25, 2016

Hello, i facing problem on this sketch.js as well. when i save in mobile browser, the last sketch of the sketching was unable to saved. while in desktop browser, it can be saved. It seem like, sketch.js unable to catch the last sketch data and pass to the parameter in mobile browser. Anyone can guide me how to solve it ? TQ.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants