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

[Bug]: Unable to Select Top Layer When Overlapping with Larger Layer #282

Open
Khlimenkov opened this issue Dec 10, 2024 · 3 comments
Open
Labels
bug Something isn't working in-progress

Comments

@Khlimenkov
Copy link

Khlimenkov commented Dec 10, 2024

Package Version

6.2.0

Flutter Version

3.22.2

Platforms

Web

How to reproduce?

  1. Add two layers to the editor:
  • The first layer should be larger than the second (you can scale the first layer to make it bigger).
  • Place the smaller layer on top of the larger layer.
  1. Select the larger layer.
  2. Attempt to select the smaller (top) layer.

I think the problem is related to the DeferPointer.

Expected Behavior:
The smaller (top) layer should be selectable.

Actual Behavior:
The smaller (top) layer cannot be selected.

And there issue is reproduce - you cant select layer that on top of another.

A video demonstrating the issue is attached for reference:

Screen.Recording.2024-12-10.at.18.27.55.1.1.mp4

Logs (optional)

No response

Example code (optional)

No response

Device Model (optional)

Browser

@Khlimenkov Khlimenkov added the bug Something isn't working label Dec 10, 2024
@hm21
Copy link
Owner

hm21 commented Dec 11, 2024

Thanks for reporting the issue.

I also think the problem comes from the DeferPointer. The problem is, we need the DeferPointer that Flutter can handle interactions on transformed layers correctly. For example, if you draw a vertical line and rotate it to horizontal, Flutter might not detect gestures properly because it’s outside the normal bounds.

I don’t have a solution for this at the moment, but I plan to run more tests when I have time. If you’d like to try finding a solution yourself, I recommend checking here.

@faiyazz-shaikh
Copy link

As a quick fix, I have removed the DeferredPointerHandler from the main editor and placed it inside the LayerWidget, as it seems to cause issues when used with multiple widgets or a list of widgets.

gskinnerTeam/flutter-defer-pointer#2

Removed from the main Editor
Screenshot 2024-12-28 at 4 57 39 PM

Put Inside LayerWidget -> Positioned -> DeferredPointerHandler
Screenshot 2024-12-28 at 4 57 14 PM

vid.mov

@hm21
Copy link
Owner

hm21 commented Dec 29, 2024

@faiyazz-shaikh

That’s good to know—it’s helpful to understand that it works in this way. However, the question now is how this impacts performance when creating a DeferredPointerHandler for every layer, especially for users who require a large number of layers.

I think it would be a good idea to make some tests on both iOS and Android devices to check if this approach results in a significant performance difference or if the impact is negligible.

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

No branches or pull requests

3 participants