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

svg.js: a shape should not be draggable when the point tool is selected #30

Closed
amitguptagwl opened this Issue Jun 7, 2018 · 8 comments

Comments

Projects
None yet
2 participants
@amitguptagwl
Member

amitguptagwl commented Jun 7, 2018

starting point: v2.html
link: https://naturalintelligence.github.io/imglab/v2.html

  1. Load an image into the galleries
  2. select an image to load in workarea
  3. draw a rectangle on image
  4. select point tool and create a point on rectangle . hold the mouse button and drag. shape should not be dragged

Check technical documentation.

@rohitkrishna094

This comment has been minimized.

Contributor

rohitkrishna094 commented Jun 15, 2018

I would like to try this. When you say you don't want the shape to move, you are referring to rectangle right? Because when we try to add red points at a faster pace, we will drag our mouse unintentionally which actually also drags the green rectangle. So we should stop that from happening right?

@amitguptagwl

This comment has been minimized.

Member

amitguptagwl commented Jun 15, 2018

In current implementation,

  1. You can create a shape on SVG canvas (not on another shape).
  2. You can drag a shape even if you've selected a shape tool because of point 1.
  3. You can draw a point inside a shape. But because of point 1 and 2, you can even drag a shape when you just want to draw a point.

Expectations to avoid accidents

When a shape tool is selected, user should not be able to select / move any shape. Instead, to move a shape, move tool must be selected. (will assign a hot key to select any tool as a part of other story)

I hope I'm clear. Any feedback or question is welcome.

@rohitkrishna094

This comment has been minimized.

Contributor

rohitkrishna094 commented Jun 15, 2018

Ok, now I understand most of it. I will try with this issue and comment here again if I stumble upon any problems. Thanks

@amitguptagwl

This comment has been minimized.

Member

amitguptagwl commented Jul 1, 2018

@rohitkrishna094 are you still on the issue?

@rohitkrishna094

This comment has been minimized.

Contributor

rohitkrishna094 commented Jul 2, 2018

Sorry for the late reply. Yes I am this issue. Will complete is asap and do a PR for review.

@amitguptagwl

This comment has been minimized.

Member

amitguptagwl commented Jul 2, 2018

Thanks Rohit.

@amitguptagwl

This comment has been minimized.

Member

amitguptagwl commented Jul 17, 2018

@rohitkrishna094 As this issue was open from a long time, I've fixed that. Here is the solution for learning purpose;

currentTool.on('mousedown', function (e) {
    if(!selectedTool || selectedTool.type !== "move"){
        e.preventDefault();
        e.stopPropagation();
    }
});
@rohitkrishna094

This comment has been minimized.

Contributor

rohitkrishna094 commented Jul 17, 2018

Oh sorry. Totally forgot about this issue. Thank you, that was a great learning opportunity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment