flame icon indicating copy to clipboard operation
flame copied to clipboard

can support 【set transformMatrix(Matrix4 value)】 for Transform2D

Open toly1994328 opened this issue 1 year ago • 4 comments

Problem to solve

When set position or zoom will notifyListeners immediately,But I want to be more flexible with Matrix4, Please support 【set transformMatrix(Matrix4 value)】 for Transform2D

Proposal

set transformMatrix(Matrix4 value) { _transformMatrix = value.clone(); notifyListeners(); }

More information

No response

Other

  • [ ] Are you interested in working on a PR for this?

toly1994328 avatar Jul 22 '24 00:07 toly1994328

Sounds good Matrix4.setFrom should be used though so that it doesn't need to create a new object. Do you want to provide a PR for this?

spydon avatar Jul 22 '24 07:07 spydon

Sure, Thanks you . PR in https://github.com/flame-engine/flame/pull/3233 . Now, I can easily implement this interaction:

https://github.com/user-attachments/assets/f68e5f6e-cf4e-4cab-9cc3-f6484c76dc94

toly1994328 avatar Jul 22 '24 16:07 toly1994328

oh, You should change this filed when set transformMatrix. This is difficult for me, so please handle it by your self ~

image

toly1994328 avatar Jul 22 '24 22:07 toly1994328

Hi, I've taken an interest in this issue and I'd like to be assigned to it if that's alright.

Seems like adding set transformMatrix would be usefull, but the need to update some attributes like _position results in listeners being notified a few times which undermines part of the issue.

listeners mark

This could be solved by adding a new boolean into the class which is only set to true when set transformMatrix is updating these variables and doesn't let _markAsModified run notifyListeners during that time. I'd understand if this solution feels too encroaching though.

Jacda avatar Dec 07 '24 17:12 Jacda