Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ghost opened this issue Mar 19, 2019 · 9 comments

Comments

@ghost
Copy link

ghost commented Mar 19, 2019

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.

@footniko
Copy link

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;

@ghost
Copy link
Author

ghost commented May 18, 2019

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
Copy link
Author

ghost commented May 18, 2019

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.

@satyarihad
Copy link

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

Thanks

@Quadraphos
Copy link

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.

@Larry-Arun
Copy link

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.

1 similar comment
@Larry-Arun
Copy link

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
Copy link

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.

@Quadraphos
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants