muaz-khan / Canvas-Designer

Collaborative, extendable, JavaScript Canvas2D drawing tool, supports dozens of builtin tools, as well as generates JavaScript code for 2D animations.

Home Page:https://www.webrtc-experiment.com/Canvas-Designer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I have some doubts...

LucasHimelfarb opened this issue · comments

Hi Muaz Khan,

I have some doubts:

  • Have the library support for mobile devices? I can't draw on Android.
  • How can I make the canvas responsive?
  • Can two peers draw at the same time? I have some issues when two persons are drawing, because the canvas only render one of them.

Best regards,

@LucasHimelfarb You can open following URL on your mobile device and it will/should work:

Default demo doesn't works because this project is currently using iframes. IFrames doesn't seems to listen for touch events correctly.

Need to directly inject HTML on target websites. It will fix touch issues. It is in my todo list and I'm planning to work on it soon.

Regarding two-peer-draw-at-same-time, it is gonna be tricky to fix it. Nee to use object i.e. {key:value} rather than arrays where key is a unique identifier of the drawing same contains all required information draw shape on valid order. It will fix all sycing issues. Need to work on it as well, however lets fix mobile touch issues first.

Regarding responsive canvas, injecting HTML on target website will fix this issue as well. We need to move away from iframes.

Thanks for your work, I hope your updates Muaz Khan... thanks for the quick response <3

To solve android can not draw line problem, you can try the following method:

  • widget.js
    Find the line:
    isTouch = 'createTouch' in document; ]
    Change to
    isTouch = ('createTouch' in document) || ('ontouchstart' in document);
  • isTouch = ('createTouch' in document) || ('ontouchstart' in document);
    This Fixed
    Fixed even in iframe for me
    Thanks !

can anyone can share working widget.js file because above change won't worked for me