Canvas-Designer icon indicating copy to clipboard operation
Canvas-Designer copied to clipboard

How to enable the panel to select the thickness and color of the pencil or marker?

Open ghost opened this issue 5 years ago • 9 comments

Muaz, thanks for the example https://www.webrtc-experiment.com/Canvas-Designer/

How to enable in Chrome browser the panel to select the thickness and color of the pencil or marker? I search marker-stroke-style and marker-color-container through the instructions but did not see the answer.

ghost avatar Mar 19 '19 23:03 ghost

In the widget.js change to the pencilDrawHelper.getOptions function (approx. line 1733) add this before return statement:

pencilLineWidth = document.getElementById('line-width-text').value;
pencilStrokeStyle = document.getElementById('stroke-style').value;

footniko avatar May 18 '19 16:05 footniko

Thanks, footniko, it helps:

pencilDrawHelper.getOptions = function() {
	pencilLineWidth = document.getElementById('line-width-text').value;
	pencilStrokeStyle = document.getElementById('stroke-style').value;

	return [pencilLineWidth, pencilStrokeStyle, fillStyle, globalAlpha, globalCompositeOperation, lineCap, lineJoin, font];
}

ghost avatar May 18 '19 23:05 ghost

But the code has a separate possibility to change the parameters of the pencil. It seems that I do not know how to activate it.

ghost avatar May 18 '19 23:05 ghost

Hi, I am trying to change the thickness and color of pencil but its not working, can anyone help me.

Thanks

satyarihad avatar Jun 17 '19 05:06 satyarihad

But the code has a separate possibility to change the parameters of the pencil. It seems that I do not know how to activate it.

Do you find the way to activate it? I have been trapped here long time. Thanks in advanced.

Quadraphos avatar Feb 04 '20 07:02 Quadraphos

The function hidecontainers() in line 2886 of widget.js should be commented out to solve this problem. Because the function of setselection(this, shape) hides everything.

But the code has a separate possibility to change the parameters of the pencil. It seems that I do not know how to activate it.

Do you find the way to activate it? I have been trapped here long time. Thanks in advanced.

The function hidecontainers() in line 2886 of widget.js should be commented out to solve this problem.Because the function of setselection(this, shape) hides everything.

Larry-Arun avatar Mar 11 '20 02:03 Larry-Arun

The function hidecontainers() in line 2886 of widget.js should be commented out to solve this problem. Because the function of setselection(this, shape) hides everything.

But the code has a separate possibility to change the parameters of the pencil. It seems that I do not know how to activate it.

Do you find the way to activate it? I have been trapped here long time. Thanks in advanced.

The function hidecontainers() in line 2886 of widget.js should be commented out to solve this problem.Because the function of setselection(this, shape) hides everything.

Larry-Arun avatar Mar 11 '20 02:03 Larry-Arun

The function hidecontainers() in line 2886 of widget.js should be commented out to solve this problem.Because the function of setselection(this, shape) hides everything.

Larry-Arun avatar Mar 11 '20 02:03 Larry-Arun

The function hidecontainers() in line 2886 of widget.js should be commented out to solve this problem.Because the function of setselection(this, shape) hides everything.

Thanks for your reply. I have already figured out the problems. But I didn't try to solve it in widget.js. I solved it in canvas-designer.html. Here is my code, by using this code. You can use pencil and marker container by doubleclick icon.

function setStyle(){ var markerSel = designer.iframe.contentWindow.document.getElementById("marker-icon"); var pencilSel = designer.iframe.contentWindow.document.getElementById("pencil-icon");

markerSel.ondblclick = function (){
    designer.iframe.contentWindow.document.getElementById("marker-container").style.display = 'block';
}
pencilSel.ondblclick = function (){
    designer.iframe.contentWindow.document.getElementById("pencil-container").style.display = 'block';
}

} setTimeout("setStyle()", 3000);

I think this way is more efficient.

Quadraphos avatar Mar 11 '20 02:03 Quadraphos