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

if use css set canvas to half of it,and then can't drag,how to fixed this? #359

Open
xmcase opened this issue Aug 20, 2020 · 1 comment
Open

Comments

@xmcase
Copy link

xmcase commented Aug 20, 2020

<script type="text/javascript"> $('#canvas').drawArc({ layer: true, draggable: true, fillStyle: '#36c', x: 300, y: 300, radius: 50, }); </script>

code like this, if I set canvas width 300px,height 300px, like this " ",and then can't drag again.

@caleb531
Copy link
Owner

@xmcase How are you setting the canvas width? It will skew the canvas coordinate system if you try to change the canvas width/height with CSS; that is probably why your drag is skewed.

Instead, you need to set the canvas width/height using jQuery's attr() or prop() methods:

$('#my-canvas').prop({
    width: 300,
    height: 300
});

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

2 participants