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

Draw deletion in MPR #1468

Closed
ychyss opened this issue Aug 7, 2023 · 1 comment
Closed

Draw deletion in MPR #1468

ychyss opened this issue Aug 7, 2023 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@ychyss
Copy link

ychyss commented Aug 7, 2023

When I use draw under MPR layout, there is a deletion error.

The first window is normal. But the others(coronal and sigittal) cannot delete drawings.

I traced this bug, find that:
In draw.js->setShapeOn->shapeGroup.on('dragmove.draw'), the scale of this.#trash may be negtive, and the trashHalfHeight may be negetive, so the condition don't work.

if (Math.abs(eventPos.x - this.#trash.x()) < trashHalfWidth &&
        Math.abs(eventPos.y - this.#trash.y()) < trashHalfHeight) {
...
}

just add a abs on this value in both shapeGroup.on('dragmove.draw') and shapeGroup.on('dragend.draw'):

// 这里由于scale可能出现负数,因此取绝对值
const trashHalfWidth =
  Math.abs(this.#trash.width() * this.#trash.scaleX() / 2);
const trashHalfHeight =
  Math.abs(this.#trash.height() * this.#trash.scaleY() / 2);

now,it works! :-)

@ivmartel ivmartel changed the title Draw deletion in multi layergroups Draw deletion in MPR Aug 14, 2023
@ivmartel ivmartel added the bug Something isn't working label Aug 14, 2023
@ivmartel ivmartel added this to the 0.33.0 milestone Aug 14, 2023
@ivmartel
Copy link
Owner

Thanks for reporting and finding a solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants