Graphite icon indicating copy to clipboard operation
Graphite copied to clipboard

Offset click targets with the boolean operations

Open 0HyperCube opened this issue 1 year ago • 1 comments

By creating two layers, applying a boolean operation, then panning the document, the click targets become offset for the original layers.

This occurs because the boolean layer node has a Memoize Impure node inside of it, so the click targets are not updated when the document is panned.

Click targets are stored in layer space. In order to compare with the mouse it is necessary to calculate the transform from layer to viewport. We do this using transform_to_document which in tern uses the footprint. Footprints are always stored in viewport space. By not reprocessing the monitor node that stores the footprint, the click targets become offset.

The easiest fix is to remove the memoize impore node from the boolean node. Keavon claims that without this Memoize impure node, the performance is too bad. I'm not sure how else to approach this.

0HyperCube avatar Aug 03 '24 13:08 0HyperCube

Why is the Footprint transform used instead of using the current document_to_viewport transform? Instead of .map(|(footprint, transform)| footprint.transform * transform), .map(|(_, transform)| self.document_to_viewport * transform) can be used, which seems to solve the issue.

Edit: I spent a while talking to True Doctor about this and we came up with a new idea where the click targets are calculated during rendering, and sent in viewport coordinates to the render on every execution of the network.

adamgerhant avatar Aug 23 '24 17:08 adamgerhant