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

fixes: remove unfinished shapes, remove selectable and make shapes remain inside canvas #2809

Merged
merged 21 commits into from
Nov 24, 2023

Conversation

krmanik
Copy link
Contributor

@krmanik krmanik commented Nov 6, 2023

@krmanik
Copy link
Contributor Author

krmanik commented Nov 6, 2023

Click through transparent area have following warning.

Canvas2D: Multiple readback operations using getImageData are faster with the willReadFrequently attribute set to true. See: https://html.spec.whatwg.org/multipage/canvas.html#concept-canvas-will-read-frequently

I have tried this for both upper and lower canvas, but it does not solve the warning so maybe the issues is in fabric.js.

canvas.getContext("2d", {willReadFrequently: true});

@dae
Copy link
Member

dae commented Nov 8, 2023

Thanks a lot for looking into these Mani! I'll give them a proper review in the next few days after 23.10.1 is out the door.

@BEST8OY
Copy link

BEST8OY commented Nov 9, 2023

Not sure if I'm allowed to ask for this here, sorry in advance if I'm not.
A shortcut for "Toggle Masks" in reviewer would be handy.
Something like "M"

@krmanik
Copy link
Contributor Author

krmanik commented Nov 10, 2023

Not sure if I'm allowed to ask for this here, sorry in advance if I'm not. A shortcut for "Toggle Masks" in reviewer would be handy. Something like "M"

Added key H for toggle mask because, M is already assigned to menu.

@dae
Copy link
Member

dae commented Nov 13, 2023

Sorry for the delay here Mani - I've just gotten around to testing this. There seems to have been a regression in the positioning of images in the editor. I open the editor, select an image, and the image is offset to the right, with the right side cut off:

2023-11-13T10:47:06,814411483+10:00

If I use the zoom tool, I can move the image so it appears correctly, but when I resize the window it moves back to the right.

It appears to have regressed in d44de20.

Other notes:

  • Zooming seems to work well in the editor, but I would say we haven't solved Image occlusion doesn't scale when page zoomed in #2588 until the review screen supports zooming too. Minor: when making the window bigger, the mask borders get blurry.
  • The shortcuts are a nice addition, but currently they conflict with the text tool - for example, try typing a 'p' into a text area
  • Very minor: rectangles and ellipses are moved inside bounds after you let go of the mouse, whereas polygons and groups are never allowed to leave the bounds. If it's very easy to make the former behave like the latter, maybe it would be worth doing that to be consistent?
  • Other fixes look good!

ts/image-occlusion/mask-editor.ts Outdated Show resolved Hide resolved
ts/image-occlusion/review.ts Show resolved Hide resolved
@krmanik
Copy link
Contributor Author

krmanik commented Nov 14, 2023

Fixing these issues added more issues, I will push the changes considering above suggested review in next commit latest by weekend. :-)

Todo - add shortcuts info to tooltip

@krmanik krmanik force-pushed the io-fixes branch 2 times, most recently from 795008d to bc38f29 Compare November 14, 2023 11:55
@dae
Copy link
Member

dae commented Nov 16, 2023

No problem Mani, please let me know when you're ready for another review.

@krmanik krmanik force-pushed the io-fixes branch 2 times, most recently from 6058963 to fad32cc Compare November 22, 2023 16:00
@krmanik
Copy link
Contributor Author

krmanik commented Nov 22, 2023

I have solved some of minor IO issues and it should be merged first then I will check other issues in next PR.

@krmanik krmanik force-pushed the io-fixes branch 3 times, most recently from d23ff2e to 59692e8 Compare November 23, 2023 05:10
@dae
Copy link
Member

dae commented Nov 23, 2023

Hi Mani,

There's one issue that I think we should probably solve before merging this in, as it will break the text tool for people using git otherwise. I see you've pushed c689444, which has presumably fixed editing, but I hadn't actually noticed that issue. What I meant in my earlier comment is that when the text tool is used (below polygon), it's not possible to type text into it because the shortcuts are still active.

Re 5a27427, we don't include the shortcuts inside translation strings - instead they are stored separately, so we can modify them depending on the platform, and change them without breaking translations. For example, the bold button:

    const keyCombination = "Control+B";
...
    <IconButton
        tooltip="{tr.editingBoldText()} ({getPlatformString(keyCombination)})"

@krmanik
Copy link
Contributor Author

krmanik commented Nov 23, 2023

I have updated the shortcut implementation as suggested.

The Ctrl+R is conflicting with RemoveFormatButton, what could be solution if we want to use Ctrl+R for rectangle tool?

@dae
Copy link
Member

dae commented Nov 24, 2023

Thanks Mani, I'll merge this in now and we can make any further tweaks in follow-up PRs.

One possible way to work around the RemoveFormatButton issue would be to only enable that shortcut when the IO mask editor is not visible. That said, I think users coming from the existing add-on may miss the existing shortcuts, that don't require the control key. Maybe an alternative solution would be to use the text:editing:entered and text:editing:exited events to set a editingTextElement flag, and only respond to those shortcut keys when the flag is not set?

@dae dae merged commit be1f889 into ankitects:main Nov 24, 2023
@krmanik
Copy link
Contributor Author

krmanik commented Nov 24, 2023

I will match the keyboard shortcut and use the text event in next PR.

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

Successfully merging this pull request may close these issues.

3 participants