Git Product home page Git Product logo

muaz-khan / canvas-designer Goto Github PK

View Code? Open in Web Editor NEW
366.0 29.0 171.0 1.44 MB

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/

License: MIT License

JavaScript 80.99% HTML 19.01%
javascript canvas canvas-designer tool webrtc rtcmulticonnection

canvas-designer's Introduction

Advance Demo: demos/dashboard/

Multiple designers demo: https://www.webrtc-experiment.com/Canvas-Designer/multiple.html

YouTube video:

npm downloads Build Status: Linux

"Collaborative" Canvas Designer i.e. Canvas-Drawing tool allows you draw bezier/quadratic curves, rectangles, circles and lines. You can also set strokes, back/forth colors and much more. You can draw using pencils, erase drawing, type texts etc. You can easily add your own tools.

You can check all releases here:

The specialty of this drawing-tool is that, it generates Canvas2D code for you; so simply draw and get the code! That code can be used in any javascript Canvas2D application.

You can submit issues here:

Also, you can collaborate your drawing with up to 15 users; and everything is synced from all users. So, if you draw a line and your friend-A draws quadratic curve and friend-B draws rectangle then everything will be synced among all users!

Youtube Videos

Gif images:

Built-in tools

You can use designer.setSelected or designer.setTools for below tools.

  1. line --- to draw straight lines
  2. pencil --- to write/draw shapes
  3. dragSingle --- to drag/ove and especially resize last selected shape
  4. dragMultiple --- to drag/move all shapes
  5. eraser --- to erase/clear specific portion of shapes
  6. rectangle --- to draw rectangles
  7. arc --- to draw circles
  8. bezier --- to draw bezier curves
  9. quadratic --- to draw quadratic curves
  10. text --- to write texts on single or multiple lines, select font families/sizes and more
  11. image --- add external images
  12. arrow --- draw arrow lines
  13. marker --- draw markers
  14. lineWidth --- set line width
  15. colorsPicker --- background and foreground colors picker
  16. extraOptions --- extra options eg. lineCap, lineJoin, globalAlpha, globalCompositeOperation etc.
  17. pdf --- to import PDF
  18. code --- to enable/disable code view
  19. undo --- undo recent shapes

The correct name for dragSingle should be: drag-move-resize last-selected-shape.

The correct name for dragMultiple should be: drag-move all-shapes.

Upcoming tools

  1. Allow users to add video-streams or screen-streams or existing-webm-mp4-videos
  2. Resize all shapes at once (currently you can resize last selected shape only)

Features

  1. Draw single or multiple shapes of any kind (according to toolbox)

  2. Drag/resize/adjust all the shapes in any possible direction

  3. Rectangles and images can be resized in 4-directions

    Red transparent small circles helps you understand how to resize.

  4. Undo drawings using ctrl+z keys (undo all shapes, undo last 10 or specific shapes, undo range of shapes or undo last shape)

  5. Drag/move single or all the shapes without affecting any single coordinate

More importantly, you can use unlimited designers on a single page. Each will have its own surface and its own tools.

Chinese, Arabic, other languages

You can install following chrome extension for multi-language input tools:

Now type your own language text in any <input> box or anywhere, and simply copy that text.

Now click T tool icon from the tool-box and press ctrl+v to paste your own language's text.

To repeat it:

  1. Type your own language texts anywhere and make sure to copy to clipboard using ctrl+v
  2. Then click T icon, and then press ctrl+v to paste your copied text

You can paste any text: English, Arabic, Chinese etc.

How to Use

  1. Download/link canvas-designer-widget.js from this github repository.

  2. Set designer.widgetHtmlURL and designer.widgetJsURL in your HTML file.

  3. Use this command to append widget in your HTML page:

    var designer = new CanvasDesigner();

    designer.appendTo(document.body);

<!-- 1st step -->
<script src="https://www.webrtc-experiment.com/Canvas-Designer/canvas-designer-widget.js"></script>

<!-- 2nd step -->
<script>
var designer = new CanvasDesigner();

// both links are mandatory
// widget.html will internally use widget.js
designer.widgetHtmlURL = 'https://www.webrtc-experiment.com/Canvas-Designer/widget.html'; // you can place this file anywhere
designer.widgetJsURL = 'https://www.webrtc-experiment.com/Canvas-Designer/widget.js';     // you can place this file anywhere
</script>

<!-- 3rd i.e. last step -->
<script>
// <iframe> will be appended to "document.body"
designer.appendTo(document.body || document.documentElement);
</script>

Complete Usage

var designer = new CanvasDesigner();

websocket.onmessage = function(event) {
    designer.syncData( JSON.parse(event.data) );
};

designer.addSyncListener(function(data) {
    websocket.send(JSON.stringify(data));
});

designer.setSelected('pencil');

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

designer.appendTo(document.documentElement);

It is having designer.destroy() method as well.

Use WebRTC!

webrtc.onmessage = function(event) {
    designer.syncData( event.data );
};

designer.addSyncListener(function(data) {
    webrtc.send(data);
});

Use Socket.io

socket.on('message', function(data) {
    designer.syncData( data );
});

designer.addSyncListener(function(data) {
    socket.emit('message', data);
});

API Reference

widgetHtmlURL

You can place widget.html file anywhere on your site.

designer.widgetHtmlURL = '/html-files/widget.html';

By default widget.html is placed in the same directory of index.html.

// here is default value
designer.widgetHtmlURL = 'widget.html';

Remember, widget.html is loaded using <iframe>.

widgetJsURL

Note: This file is internally used by widget.html.

You can place widget.html file anywhere on your site.

designer.widgetJsURL = '/js-files/widget.min.js';

By default widget.min.js is placed in the same directory of index.html.

// here is default value
designer.widgetJsURL = 'widget.min.js';

Remember, widget.js is loaded using <iframe>.

syncData

Pass array-of-points that are shared by remote users using socket.io or websockets or XMPP or WebRTC.

designer.syncData(arrayOfPoints);

An example to pass custom data on Canvas-Designer:

var x = 0;
var y = 0;
var width = designer.iframe.clientWidth;
var height = designer.iframe.clientHeight;

var image = 'https://www.webrtc-experiment.com/images/RTCMultiConnection-STUN-TURN-usage.png';

var points = [
    ['image', [image, x, y, width, height, 1], ['2', '#6c96c8', 'rgba(0,0,0,0)', '1', 'source-over', 'round', 'round', '15px "Arial"']]
];

designer.syncData({
    startIndex: 0,
    points: points
});

clearCanvas

Remove and clear all drawings from the canvas:

designer.clearCanvas();

renderStream

Call this method internally to fix video rendering issues.

designer.renderStream();

addSyncListener

This callback is invoked as soon as something new is drawn. An array-of-points is passed over this function. That array MUST be shared with remote users for collaboration.

designer.addSyncListener(function(data) {
    designer.send(JSON.stringify(data));
});

setSelected

This method allows you select specific tools.

designer.setSelected('rectangle');

setTools

This method allows you choose between tools that should be displayed in the tools-panel.

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

icons

You can force/set your own tool-icons:

designer.icons = {
    line: '/icons/line.png',
    arrow: '/icons/arrow.png',
    pencil: '/icons/pencil.png',
    dragSingle: '/icons/dragSingle.png',
    dragMultiple: '/icons/dragMultiple.png',
    eraser: '/icons/eraser.png',
    rectangle: '/icons/rectangle.png',
    arc: '/icons/arc.png',
    bezier: '/icons/bezier.png',
    quadratic: '/icons/quadratic.png',
    text: '/icons/text.png',
    image: '/icons/image.png',
    pdf: '/icons/pdf.png',
    pdf_next: '/icons/pdf-next.png',
    pdf_prev: '/icons/pdf-prev.png',
    marker: '/icons/marker.png',
    zoom: '/icons/zoom.png',
    lineWidth: '/icons/lineWidth.png',
    colorsPicker: '/icons/colorsPicker.png',
    extraOptions: '/icons/extraOptions.png',
    code: '/icons/code.png'
};

You can set like this as well:

designer.icons.line = '/icons/line.png';

Default values are NULL to force icons from /dev/data-dris.js.

appendTo

CanvasDesigner is a widget; that widget should be appended to a DOM object. This method allows you pass <body> or any other HTMLDOMElement.

designer.appendTo(document.body || document.documentElement);

// or
designer.appendTo(document.body || document.documentElement, function() {
    alert('iframe load callback');
});

The correct name for appendTo is: append-iframe to target HTML-DOM-element

destroy

If you want to remove the widget from your HTMLDOMElement.

designer.destroy();

iframe

You can access designer iframe as following:

designer.iframe.style.border = '5px solid red';

window.open(designer.iframe.src);

designer.iframe will be null/undefined until you call appendTo. So always use this code-block:

if(!designer.iframe) {
    designer.appendTo(document.body);
}
designer.iframe.style.border = '5px solid red';

toDataURL

Get data-URL of your drawings!

designer.toDataURL('image/png', function(dataURL) {
    window.open(dataURL);
});

sync

You can manually sync drawings by invoking designer.sync method:

designer.sync();

Here is a real usecase:

webrtcDataChannel.onopen = function() {
    if(designer.pointsLength > 0) {
        // you seems having data to be synced with new user!
        designer.sync();
    }
};

captureStream

Get MediaStream object and share in realtime using RTCPeerConnection.addStream API.

<script src="dev/webrtc-handler.js"></script>
<script>
designer.captureStream(function(stream) {
    var url = URL.createObjectURL(stream);
    videoPreview.src = url;

    rtcPeerConnection.addStream(stream);
    rtcPeerConnection.createOffer(success, failure, params);
});
</script>

pointsLength

Each shape is considered as a point. This value allows you check number of shapes that are already drawn on the canvas-designer.

(function looper() {
    document.getElementById('number-of-shapes').inenrHTML = designer.pointsLength;
    setTimeout(looper, 1000);
})();

Or a real usage:

websocket.onopen = function() {
    if(designer.pointsLength > 0) {
        // you seems having data to be synced with existing users!
        designer.sync();
    }
};

undo

You can either undo drawings by pressing ctrl+z on windows and command+z on Mac; however you can undo using designer.undo method as well:

designer.undo();   // undo last shape
designer.undo(-1); // undo last shape

// undo shape from specific index
designer.undo(0);

// undo all shapes
designer.undo('all');

// undo last 10 shapes
designer.undo({
    numberOfLastShapes: 10
})

// to remove all occurrences of a specific shape
designer.undo('pencil');
designer.undo('arrow');
designer.undo('rect');

designer.pointsLength shows number of shapes; and designer.undo accepts shape-index as well.

Add New Tools

First Step

Open widget.html and add your new tool-icon HTML.

<div id="tool-box" class="tool-box"> <!-- search for this div; and include your HTML inside this div -->
    <canvas id="yourNewToolIcon" width="40" height="40"></canvas> <!-- here is your icon-HTML -->
</div>

Second Step

Open decorator.js and decorate your new HTML icon.

var tools = {
    yourNewToolIcon: true // add this line to make sure index.html can use it
};

Search for decorateLine method, and append following snippet quickly after that method:

function decorateYourNewToolIcon() {
    var context = getContext('yourNewToolIcon');

    context.fillStyle = 'Gray';
    context.font = '9px Verdana';
    context.fillText('New', 16, 12);

    bindEvent(context, 'YourNewToolIconSelected');
}

if (tools.yourNewToolIcon === true) {
    decorateYourNewToolIcon();
} else document.getElementById('yourNewToolIcon').style.display = 'none';

Third Step

Open common.js and add selection-states for your new tool-icon (i.e. whether your new tool icon is selected or not):

var is = {
    isYourNewToolIconSelected: false, // add this line

    set: function (shape) {
        var cache = this;

        cache.isYourNewToolIconSelected = false; // add this line as well.

        // ..... don't modify anything else
        cache['is' + shape] = true;
    }
};

You merely need to set isYourNewToolIconSelected:true also cache.isYourNewToolIconSelected=false.

Fourth Step

Create new file in the dev directory. Name this file as yourNewToolIcon-handler.js.

This file MUST look like this:

var yourNewToolIconHandler = {
    ismousedown: false,

    mousedown: function(e) {
        this.ismousedown = true;
    },

    mouseup: function(e) {
        this.ismousedown = false;
    },

    mousemove: function(e) {
        if(this.ismousedown) { ... }
    }
};

You can check other *-handler.js from dev directory to get the idea how exactly it works.

Now open Gruntfile.js#L43 and add link to your new file: dev/events-handler.js.

Now compile all your changes using grunt.

Fifth Step

Open events-handler.js and make sure that your above yourNewToolIconHandler object is called for mouse up/down/move events.

addEvent(canvas, isTouch ? 'touchstart' : 'mousedown', function (e) {

    // you merely need to add this line at the end of this method
    else if (is.isYourNewToolIconSelected) yourNewToolIconHandler.mousedown(e);
});

addEvent(document, isTouch ? 'touchend' : 'mouseup', function (e) {

    // you merely need to add this line at the end of this method
    else if (is.isYourNewToolIconSelected) yourNewToolIconHandler.mouseup(e);
});

addEvent(canvas, isTouch ? 'touchmove' : 'mousemove', function (e) {

    // you merely need to add this line at the end of this method
    else if (is.isYourNewToolIconSelected) yourNewToolIconHandler.mousemove(e);
});

First of all, we are checking whether your tool-icon is selected or not: is.isYourNewToolIconSelected

Then we are calling yourNewToolIconHandler dot mousedown/mouseup/mousemove events respectively.

Sixth Step

Open draw-helper.js. Make sure that your new tool-icon can be drawn on the <canvas> surface.

yourNewToolIcon: function(context, point, options) {
    context.beginPath();
    context.moveTo(point[0], point[1]);
    context.whateverYouWantToDoHere(point[2], point[3]);

    this.handleOptions(context, options);
}

Usually point[0] is x coordinates; point[1] is y coordinates; point[2] is width and point[3] is height.

Different shapes can handle these points differently.

There is NO-limit for point[index]. You can add as many points as you want.

Complex shapes can add 10 or 20 points.

Seventh Step

Open drag-helper.js and make sure that your new shape can be dragged/resized/move.

Search for p[0] === 'line' and add similar code-blocks for your shape (new-tool-icon) as well.

Eighth Step

Open common.js and make sure that your new shape (tool-icon) is printed on the <textarea> as well.

This allows end-users to copy your shape's code and use anywhere on their own web-pages.

Open common.js file; there is a function updateTextArea inside the "common" object โ€“ which is aimed to output into textarea element.

You don't have to change updateTextArea. For simplicity purpose, code is separated in different functions/properties that you've to edit:

  1. forLoop
  2. absoluteNOTShortened
  3. relativeShortened
  4. relativeNOTShortened

Search for p[0] === 'line' and add similar code-blocks for your shape (new-tool-icon) as well.

For more information

Shortcut Keys

ctrl+t (to display text-fonts box)
ctrl+z (to undo last-single shape)
ctrl+a (to select all shapes)
ctrl+c (copy last-selected shape)
ctrl+v (paste last-copied shape)

ctrl+mousedown allows you quickly copy/paste all shapes. (i.e. ctrl button + mouse down)

Signaling Server

Contributors

  1. Muaz Khan
  2. Oleg Aliullov

Please make pull-request to update this list.

License

Canvas Designer is released under MIT license . Copyright (c) Muaz Khan.

canvas-designer's People

Contributors

jacksongl avatar muaz-khan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

canvas-designer's Issues

canvas not display correct on both user connected

current I have integrate canvas designer into rectangle div 457x321, but problem: canvas not display correct on two or more user
I have attach image to easy understand, can you have a look
here is canvas from drawer
2017-06-08_22-06-02

here is canvas from receiver
2017-06-08_22-07-44

you see, receiver lack some drawing
do you have any solution for that?

Running locally

How have local signaling server on canvas. connection.socketURL . i try other signaling in your repo but iw not work when i use on canvas but on video it working fine. how to fix this? https://imgur.com/a/loWfgQx this is my error on console

CanvasDesigner with Typescript/Angular7

Hi Muaz,

I'm trying to use Canvas-Designer into my Angular7 (Typescript) application. I tried to follow the documentation and couldn't make it work with Typescript.
The 1st hurdle is at "new CanvasDesigner()" with error "ReferenceError: CanvasDesigner is not defined".

  1. Copied canvas-designer-widget.js, widget.js and widget.html files
  2. Declared both js files in "angular.json". Declared the function in ts file.
    "declare function CanvasDesigner(): void"
  3. Then the following code:
    let designer = new CanvasDesigner();
    designer.widgetHtmlURL = './widget.html';
    designer.widgetJsURL = './widget.js';

Could you offer any suggestions to resolve this error?

Change the toolbox position

Hello,,,, i have a little problem.... How to change the toolbox position from left vertical to top horizontal???

Thank you sir,, this is a great projects :)

does this work with safari ?

I am trying to make the connection work with safari but there seems to be a connection issue. The application works fine with chrome and firefox. does webrtc not work with safari ?

Can the current drawings in a canvas be saved to a database? How do we re-draw the saved object?

I am trying to save the current drawings to a database for future use. So far I am sure it can be saved but i am not sure if it can be re-draw-ed to the canvas. Also there are errors in cross domain call between canvas-designer application and WCF web-service which i am using in the save process. I am running my site on https is there any thing more that can be done to re-solve this cross domain errors.

I want to replace FirebaseIO with socketio-over-node.js but it looks like Firebaseio is bundled with RTCMulticonnect.js.

I have tried to use socketio-over-node.js and it works fine in video application but when i try to do the same for canvas designer application the user don't connect and in the node.js console there is a this message:- info-unhandled socket.io url .
I have tried to look for errors in console of Chrome this is the error i get in console:-
image
the issue might be small but as i am new and don't have complete knowledge of webrtc hence i am stuck.

how to set Stun/turn Server for canvas designer application.

I am trying to set the stun/turn server in a windows environment is it possible? if it is possible is there any link or documentation that can help me. The second part is the call to firebaseIO.com from RTCmuliticonnect.js is there any way to avoid this call. My effort is to make canvas collaboration to work under local LAN network.

Not loading properly in bootsrap tabs panels

By default canvas 2d design is in hidden, when user want to use he clicks the tab and displays the canvas 2d design box. But its not loading properly. If i set canvas 2d tab is in active mode, it works fine.

Undo option for pencil

It should clear all the points of pencil not a point by point. For arrow and lines its clearing on single click itself but for pencil, it is not.

UNDO not working with text tool

Hello,

I just selected text tool and write some text then hit "undo all" then it's not working, But I saw when I click again on screen then "undo all" works. After undo all when I'm trying to write something then it's not working. In that case I need to select text tool again. Please provide your suggestions on that. I just want if I "UNDO ALL" then click again I should be able to write.

Thanks.

Issue with Faye Sockets and Issue with IOS Safari ?

Im trying to use faye sockets as the way to sync.

It works, the only problem is, addSyncListener function doesnt seem to 'kick-in' till random data goes through the open socket first. So i have a little 'chat' app alongside the whiteboard, and it uses the same socket to communate. So the whiteboards dont sync till i send a message over the 'chat', then all of a sudden, making changes to the whiteboard is resulting in sending data over the socket.

No idea why i have to send random data over the socket first before addSyncListener will work.

Also, for some reason, on IOS safari, addSyncListener doesnt seem to ever work from what i can tell. My app running on an iphone can see the whiteboard and changes, but never sends its own changes when the user draws on the whiteboard.

Seems like addSyncListener might need some revisions or something ? Or am i doing something wrong.

Add pdf question

Hi Muaz,
Now Canvas-Designer only can add image, I want to add other, such as PDF. Do you any advice? I am looking forward to your reply.

The font tool height of i-beam and line-height

Dear Mauz,
Your font tool is very nice!! I wrote a font tool myself but it is not like yours. You can see my font tool in this firefox addon - https://addons.mozilla.org/en-US/firefox/addon/nativeshot/

I was wondering how are you calcuating line height so well when the user presses the enter key? Also how are you calculating the perfect height of the i-beam? (your ibeam top most seems to line up with top most of letter and ibeam bottom lines up with the bottoms most _ character its amazingly cool)

Thanks I'm going to dig into your code now

a few suggestions during the test

Hello, there are a few suggestions during the test:

  1. Add images and PDFs as a background so that the entire page is maximized.
  2. Upload PPTX for collaboration.
  3. Red dot function, which makes it easier for others to see my mouse position.
  4. In addition, uploaded images and PDF files seem to be deleted on the whiteboard.
  5. Zooming in and out of the whiteboard function seems to have bugs, and using the zoom function has become a zoom out function.

saving points and redrawing

Hello Muaz khan,

Thanks for nice app.

(1) I have one issue:
When I save the object that is available on the code button click and use that in

CanvasDesigner. syncData( database.arrayOfData );

The shape is drawn but color and drawing style is not preserved.

(2) I can save whiteboard screenshot as image. Is there any way we can draw image from a web url that was saved?

Thanks

Bhanu
image1

How to get clear canvas drawing image..

hello sir,
In Firefox when i draw image and erase some part and then click on export as
image button then in image, erase part also get displays but in chrome erase part not display.
how to get rid from this?

The drawing doesn't sync

When I draw incessantly the drawing doesn't sync. But this doesn't happen when I draw intermittently. Is it possible to fix?

Block user from drawing and getting rid of all the tools

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?

I have some doubts...

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,

Canvas-Designer not working

i am trying to create a collaboration drawing application. i have downloaded the code from github and trying to install it in a asp web application but it doesn't working. i get these errors:-
from RTCMulticonnect.js(line-3682):-
image
from RTCMulticonnect.js(line-4950):-
image

tool selection doesnt work on touch devices

Hi Muaz,

i am not able to switch tools on a touch enabled device. i see that in some places based on isTouch mouse events are replaces with touch events. i tried the same by registring for tap event instead of click event but with no luck.

Any pointers?

Erasing image

How to erase without erasing image and how to set size of eraser

how can change color on canvas

hi, thx for your nice code.

When i see the canvas by video tag, the background color is black.

Can cahnge background color on canvas?

How many users can collaborate this canvas?

Hi,
Your comment:
"Also, you can collaborate your drawing with up to 15 users; and everything is synced from all users. So, if you draw a line and your friend-A draws quadratic curve and friend-B draws rectangle then everything will be synced among all users!"

Is this limit for 15 online users?

There are no errors but the collaboration is not working

i have checked this in console of chrome and other browser i don't get any errors but the collaboration is not working. Is there some detail/step that i am missing out.
my console for host screen looks like this:-
image
everything looks fine to me
console for client screen looks like this:-
image
is there some installation that i have miss out on. Also i would like to add that if i run the demo present on the following link https://www.webrtc-experiment.com/Canvas-Designer/ and keep the room-id same on both the local project and the demo(present on the above link) collaboration works.

Import and Export PDF documents - Annotation

Hi muaz-khan,

I really like this tool, looks like just the thing I need to annotate documents, I just wondered if there is an option to import .pdf files, annotate and then export them?

I can see there is the import image and export image but I presume its possible to do the same with pdf or any other document extension potentially?

As I really want to annotate something like a contact and then save the annotations and share. Is this something you have done or a new feature I need to look into?

Many thanks

Jon

Collaborative web canvas

Issues of canvas designer :

1 . sometimes it takes too much time to connect with room instance.

2 . when i join the room after starting the discussions my canvas was blank and when i start writing something , all the previous instance of that room was removed, even if anyone refresh the webpage, all the content is also removed from everyone's canvas of that room.

Is there a way that we can capture live changes in the database of our server, and show them?

NS_Error_Failure

I'm allways getting the "NS_Error_Failure" error. After this error the created iFrame will stays like shown bellow:

Image

And this is the code I'm using to create a new instance.

var designer_div = document.getElementById('designer_div');
var designer = new CanvasDesigner();

//---------------------------------------------------------------Setup:---------------------------------------------------------------
designer.widgetURL = "https://cdn.webrtc-experiment.com/Canvas-Designer/widget.html";
designer.widgetJsURL = "https://cdn.webrtc-experiment.com/Canvas-Designer/widget.js";
designer.setSelected('pencil');

designer.setTools({
    pencil: true,
    text: true,
    image: true,
    eraser: true,
    line: true,
    arrow: true,
    dragSingle: true,
    dragMultiple: true,
    arc: true,
    rectangle: true,
    quadratic: true,
    bezier: true,
    marker: true,
		zoom: true
});

designer.appendTo(designer_div);

//---------------------------------------------------------------Events:--------------------------------------------------------------
connection.getSocket().on('designer-update', function(data) {
    designer.syncData(data);
});

designer.addSyncListener(function(data) {
    connection.getSocket().emit('designer-update', data);
});

//---------------------------------------------------------------Functions:-----------------------------------------------------------

Mobile Sync and Responsive iframe

Hi dude, i have some problems.

It wont work from mobile.

If I draw from computers to mobile, it works.
If I draw from mobile to computer, it does not work
The drawing does not appear.
It does not work either in your demo

Also i have some problem to make the iframe responsive.

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.