Skip to content

Inconsistent state when rotating + moving #29

Description

@ctcq

I'm trying to rotate and then move a RectangularBoxMarkerBase. Here's what I get as output for the top, left and rotationAngle properties accessed from markerArea.getState(). I left out height and width props since they do not change across steps:


  1. Marker state before rotation:
(index) 0 1
0 top 911.6034718523122
1 left 562.1380115855824
2 rotationAngle 0
  1. Now I rotate the marker to >90 degrees. top and left do not change on rotation. Which is fine, since I can infer the actual position from those and the angle:
(index) 0 1
0 top 911.6034718523122
1 left 562.1380115855825
2 rotationAngle 95.69932877020882
  1. Now I move the marker to the right:
(index) 0 1
0 top 766.8650685319997
1 left 552.29902232777
2 rotationAngle 95.69932877020882

This is the unexpected part. The values shown here do not correspond to where the marker has been dragged to, or what is shown visually for that matter. See 5. for what I'd expect.

  1. State after rotating back to approx 0 degrees. top and left are correct again:
(index) 0 1
0 top 916.1867755928424
1 left 707.1379900074969
2 rotationAngle 0.839002488562528
  1. Now rotating back to approx 95 degrees, I obtain what I'd actually have expected at 3:
(index) 0 1
0 top 916.1867755928424
1 left 707.1379900074969
2 rotationAngle 95.67315645833156

Not sure if this is a bug, or a documentation issue. I'm aware there are more props exposed by getState, namely containerTransformMatrix which might be the key to this. But it's unclear to me how to compute props from step 5 given the props from step 3 with.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions