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

Mutiple dynamic boards #61

Open vikaskumar-sourcemash opened 5 years ago

vikaskumar-sourcemash commented 5 years ago

I am able to create mutiple dynamic board but addSyncListener's callback is not being called for them. I am pushing the designer object in the array.

`var newDesigner = new CanvasDesigner();

        // you can place widget.html anywhere
        newDesigner.widgetHtmlURL = 'https://rtcmulticonnection.herokuapp.com/node_modules/canvas-designer/widget.html';
        newDesigner.widgetJsURL = 'https://rtcmulticonnection.herokuapp.com/node_modules/canvas-designer/widget.min.js'

        newDesigner.addSyncListener(function(data) {

            connection.send(data);
        });

        newDesigner.setSelected('penci');

        newDesigner.setTools({
            pencil: true,
            text: true,
            image: true,
            pdf: false,
            eraser: true,
            line: true,
            arrow: true,
            dragSingle: true,
            dragMultiple: true,
            arc: true,
            rectangle: true,
            quadratic: false,
            bezier: false,
            marker: true,
            zoom: false,
            lineWidth: false,
            colorsPicker: false,
            extraOptions: false,
            code: false,
            undo: true
        });

        newDesigner.appendTo(document.getElementById(id+'-edit-area'));
        designers.push(newDesigner);`