muaz-khan / Canvas-Designer

Collaborative, extendable, JavaScript Canvas2D drawing tool, supports dozens of builtin tools, as well as generates JavaScript code for 2D animations.
https://www.webrtc-experiment.com/Canvas-Designer/
MIT License
368 stars 171 forks source link

Block user from drawing and getting rid of all the tools #22

Closed nickborti closed 7 years ago

nickborti commented 7 years ago

I want the user to only watch the drawing but he won't have any access to select anything or draw anything.

designer.setTools({ pencil: false, text: false, ............... ................ });

After I set everything to false plus not calling designer.setSelected('pencil'); for a particular user, two things are happening.

  1. 3 tools are still showing: Line, Width and Extras
  2. Pencil tool though not showing is selected by default and I can draw easily.

So first of all, how can I call Line, Width and Extras so that I can set them to false? And how can I unselect pencil tool so that the user can't draw?

nickborti commented 7 years ago

I fixed the problem.Worked around a hack.

  1. The Line, Width and Extras can be gotten rid by removing them from html on widget.html plus by removing their specific functions defined on the javascript

2.The pencil tool or any tool is getting activated by default on widget.html page by window.setItem. Removed that to not autoselect any tool.