Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

Console errors when drawing Ellipse #25

Open
paulers opened this issue Dec 12, 2023 · 1 comment
Open

Console errors when drawing Ellipse #25

paulers opened this issue Dec 12, 2023 · 1 comment

Comments

@paulers
Copy link

paulers commented Dec 12, 2023

I read through the other issues, seems like this console error:

Error: <ellipse> attribute ry: Expected length, "undefined".
Ke @ index.js:43
Je @ index.js:43
e @ index.js:43
(anonymous) @ index.js:43
(anonymous) @ index.js:43
(anonymous) @ AnnotationLayer.js:161
index.js:43 Error: <ellipse> attribute ry: Expected length, "undefined".
Ke @ index.js:43
Je @ index.js:43
e @ index.js:43
(anonymous) @ index.js:43
(anonymous) @ index.js:43

Was mentioned in another issue, but not discussed. I dug deeper to see what the problem is, and found that on this line:

this.ellipse = drawEllipse(anchorX, anchorY, 2);
there are only 3 parameters passed to the drawEllipse method, when the method itself expects 4:
export const drawEllipse = (cx, cy, rx, ry) => {

This then gets pushed into

const setXYR = (shape, x, y, rx, ry) => {
which explodes on line 8:
shape.setAttribute('ry', ry);

Not sure what the 4th expected value is supposed to be, but figured this would make it easier to debug.

Thanks for looking!

rsimon added a commit that referenced this issue Dec 12, 2023
@rsimon
Copy link
Member

rsimon commented Dec 12, 2023

Oh, wow. Thanks for the detective work! I was vaguely aware of the issue, but never looked into it because it didn't seem to break crucial functionality. (And, also, I admit, because the Ellipse plugin was a 3rd party contribution.)

I made that tiny fix. Didn't publish an updated version of the package yet. But will do soon. For context: the drawEllipse call in line 20 of RubberbandEllipse simply creates an initial tiny ellipse when the user first starts drawing. This initial ellipse is supposed to have an (arbitrarily chosen) radius of 2px, and will then follow the mouse as the user draws. Looks like the initial call only set the x-radius, but should also have set a y-radius.

As I said: fixed now - many thinks for debugging this!

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

No branches or pull requests

2 participants