Skip to content

Fix CSS scale handling by passing through mjolnir.js event data#558

Open
rjwats wants to merge 2 commits intovisgl:masterfrom
rjwats:bugfix/149-AddCSSTransformCompensation
Open

Fix CSS scale handling by passing through mjolnir.js event data#558
rjwats wants to merge 2 commits intovisgl:masterfrom
rjwats:bugfix/149-AddCSSTransformCompensation

Conversation

@rjwats
Copy link
Contributor

@rjwats rjwats commented Mar 19, 2026

This PR fixes incorrect screen coordinate calculation in EditableLayer by using the offsetCenter provided by mjolnir.js gesture events, instead of recomputing coordinates from the DOM event (clientX/Y + canvas bounds).

I've also tightened up the types in editable-layer.ts, there are a lot of events typed as any which this tries to address too.

Some local manual testing done, no tests written yet - raising to get initial thoughts on this approach.

@rjwats
Copy link
Contributor Author

rjwats commented Mar 19, 2026

I've added a unit test for the abstract class which this PR updates. It's so heavily integrated with deck.gl and mjolnir.js that there's a lot of mocking needed to exercise the code.. maybe there's a better way to test this?

@rjwats
Copy link
Contributor Author

rjwats commented Mar 19, 2026

To locally test this you can add this div around the DeckGL element in advanced editor example:

<div
        style={{
          transform: 'scaleX(1.2) scaleY(0.8)',
          transformOrigin: 'center',
          width: '100%',
          height: '100%'
        }}
      >
        <DeckGL>.... </DeckGL>
</div>

Behavior before the fix:

before.mp4

Behavior after the fix:

after.mp4

@rjwats rjwats changed the title WIP: Fix CSS scale handling by passing through mjolnir.js event data Fix CSS scale handling by passing through mjolnir.js event data Mar 19, 2026
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.

1 participant