NaturalIntelligence / imglab

To speedup and simplify image labeling/ annotation process with multiple supported formats.
https://solothought.com/imglab/
MIT License
985 stars 609 forks source link

Fix for Issue 30: svg shape should not be draggable #60

Closed rohitkrishna094 closed 6 years ago

rohitkrishna094 commented 6 years ago

Purpose / Goal

This tries to fix issue #30 .

Type

Please mention the type of PR

Note : Please ensure that you've read contribution guidelines before raising this PR.

rohitkrishna094 commented 6 years ago

Hey I think this PR isn't completely done. When I click point tool, we are still able to move other shapes. However if we click on canvas one extra time, then the other shapes are not draggable. I am not sure where the event handler is for this. Could you please check it. Thanks.

amitguptagwl commented 6 years ago

All the event handlers related to workarea / SVG canvas are in workarea.tag.html

rohitkrishna094 commented 6 years ago

If I clicked on the point tool, how do I trigger that event? Because point tool is on toolbar div which is not part of workarea.tag. I tried using $(#toolbar).on('click', ....) but the problem with that approach is that I am unable to access the selectedTool property (which I believe is being passed by riot?) because this jquery runs before selectedTool is initialized. So if I try to access selectedTool property inside this jquery onclick event, its null. I can access selectedTool in myCanvas.on event handler though. The problem with that is as I mentioned in my previous comment.

amitguptagwl commented 6 years ago

in case of riot, if you need to use jquery selectors or bind any event do it in this.on('mount',function(){});. This is called once the component is rendered. Check like#57 in workarea.tag.html

However, I believe this issue can be fixed by just preventing event propagation when point tool is selected

e.preventDefault();
e.stopPropagation();
amitguptagwl commented 6 years ago

This PR is not valid anymore.