fix: HTML
element bounding box calculation logic #1743
#1744
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Subtract the camera's transformation from the bounding box calculation logic of the
HTML
element to keep the result consistent with the native canvas element🤔 This is a ...
🔗 Related issue link
💡 Background and solution
Detailed questions can be found #1743 .
The root cause is that the camera transformation and element transformation of G are independent, which means that if only the camera is adjusted, the transformation of the canvas element will not change.
However, the implementation of
getBoundingClientRect()
ofHTML
type elements simply calls the DOM API, because the transformation of the cameradiv
element as the parent element is also included, which is inconsistent with the calculation logic of the canvas element.Therefore, the camera transformation needs to be eliminated in the implementation of
getBoundingClientRect()
ofHTML
type elements.📝 Changelog
HTML
element to keep the result consistent with the native canvas element (#1743)HTML
元素包围盒计算逻辑中减去相机的变换,保持和原生 canvas 元素的结果一致 (#1743)☑️ Self Check before Merge