NaturalIntelligence / imglab

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

Fixed a positioning bug and implemented copy paste functionaility #103

Closed alextychan closed 6 years ago

alextychan commented 6 years ago

Purpose / Goal

Implemented copy paste svg elements.

Here's a brief description of the current implementation.

"Copy" will grab the shape and point metadata and store it in copiedElements array. The reason I store metadata rather than the object itself is to allow copy-pasting between images, because some metadata requires context that changes, like shape.rbox(myCanvas).

"Paste" will add all the shapes and points into the image, then call self.update() which redraws the current shapes in the image.

In conjunction with issue #53

Type

Please mention the type of PR

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

alextychan commented 6 years ago

Resuming #102

alextychan commented 6 years ago

I've also noticed that after drawing a shape and adding a point. When you zoom in and add a new point, the position of the point is incorrect. This should be a bug fix for another issue/pull request.

amitguptagwl commented 6 years ago

@alextychan Do you mean we should raise another PR for bug fix or you mean this is the bug introduced due to some PR in past?

first we need to understand why is it happening.

alextychan commented 6 years ago

The bug exists originally, probably in some previous PR in the past.

Steps to reproduce: 1) Add a shape. 2) Add a point 3) Zoom In/out 4) Add a new point

Expected result: point should be drawn in the shape at the place we clicked Obtained result: point drawn outside of shape at an offset

I suggest that we should open a new issue to tackle this bug.

alextychan commented 6 years ago

The copy-paste feature should be complete.

amitguptagwl commented 6 years ago

Thanks @alextychan to report the issue. I've raised the bug.

alextychan commented 6 years ago

I have found the bug for #104 and have a fix for it. Will push it once this pull request is resolved.

amitguptagwl commented 6 years ago

@alextychan is it possible for you to raise PR against copy-paste branch? So I can test the app for doubtful areas before merging to master.

amitguptagwl commented 6 years ago

Otherwise I can clone your PR on my local to test it. Give me some time.

amitguptagwl commented 6 years ago

@alextychan I've removed offline installers to other repository. Can you please syn to master branch? It'll speed up cloning.

alextychan commented 6 years ago

I have switched PR to compare with the "copy-paste" branch. Please have a look. I'll push the fix for #104 in a later PR.

alextychan commented 6 years ago

I am unable to reproduce the error. Could you provide some steps to reproduce it?

alextychan commented 6 years ago

@amitguptagwl I think you are referencing this issue #86. I will look into it separately.

amitguptagwl commented 6 years ago

@alextychan yes you're right. #86 is a missing feature till now. And doesn't break any functionality or error. But after this PR it'l become a bug for particular case. Hence we need to handle at least for copy paste scenario.

If in case I'm not able to clean my point, I can make a small animation to explain it.

What you can do at least is to unmount label tag riot.unmount('label-panel) or update it with newly pasted shape: riot.mount('label-panel', { id : currentTool.node.id }). Then this case can be handled gracefully separately without leaving any bug behind.

alextychan commented 6 years ago

@amitguptagwl That is strange indeed. I have checked my local branch and there doesn't seem to be any problems.

amitguptagwl commented 6 years ago

Here are the steps to reproduce it.

  1. Make a spae with some feature points on an image. Select and copy them.
  2. Switch to another image and paste.
  3. Delete the point from label panel. You'll notice broken animation with console error

Repeat the same steps but delete the point from the workarea directly instead of label panel. You'll not notice any issue.

imglab-copy-paste error

alextychan commented 6 years ago

@amitguptagwl Okay, I am able to reproduce the issue. Will push a fix for it.

alextychan commented 6 years ago

I have patched the bug. Please check.

amitguptagwl commented 6 years ago

Thanks for your PR.

You can also submit the detail of this PR on steemit.com to earn some rewards. Check this submission for more idea: https://steemit.com/utopian-io/@alvinvoo/project-update-imglab-new-features