fix: avoid cumulative preview set-effect transforms#962
Open
A-kirami wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a caching mechanism for effect transforms within the preview synchronization runtime. It modularizes transform merging logic into a new utility file, previewSetEffectTransform.ts, and updates previewSyncRuntime.ts to use a Map for storing baseline transforms. The cache is correctly cleared during scene resets and snippet executions to ensure state consistency. I have no feedback to provide as there were no review comments to assess.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
背景
此前 preview
set-effect会基于上一次写入后的 transform 继续合并。实时拖拽或局部调整时,未传入的字段会保留上一次 preview 值,导致位置、缩放、滤镜等效果在多次set-effect之间累积污染,也无法通过空 transform 恢复到本轮预览开始前的状态。概要
set-effect命令按 target 捕获一份 baseline transform。set-effect时,都基于 baseline 和当前 payload 计算效果,不再基于上一次 preview 结果累积。行为变化
set-effect的结果。transform: {}会把目标恢复到当前 preview 会话捕获到的 baseline。