fix: panel drag canvas adaptive#1268
Conversation
WalkthroughThe changes introduce a new reactive reference, Changes
Suggested labels
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (4)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/canvas/container/src/components/CanvasResize.vue (1)
140-145: Consider updating the returned object from setup()While the component functions correctly with the current implementation, the
draggablePanelreference is used internally but not included in the returned object fromsetup(). This is technically correct since it's only used within the component, but explicitly documenting it as a private variable (with a leading underscore) might improve code readability.return { onMouseDown, onMouseMove, sizeStyle, resizeDom + // _draggablePanel is used internally for tracking width-resizable panels }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/canvas/container/src/components/CanvasResize.vue(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: push-check
🔇 Additional comments (2)
packages/canvas/container/src/components/CanvasResize.vue (2)
93-94: Good addition of a reactive panel tracking mechanism.The new
draggablePanelreference and associated watcher effectively address the issue of canvas scaling when certain panels are dragged. The watcher monitors width changes of the draggable panel and triggers thesetScalefunction withflush: 'post'to ensure DOM updates are complete before scaling calculations.
104-108: Well-implemented panel resizability check.This check correctly identifies if a panel is width-resizable using
isPanelWidthResizable()and updates thedraggablePanelreference accordingly. This implementation addresses the PR's objective to fix adaptive scaling when dragging specific panel plugins (outline tree, page JS, and page schema).The solution is elegantly generic, handling any panel that meets the resizability criteria rather than hardcoding specific panel types.
English | 简体中文
PR
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Background and solution
What is the current behavior?
大纲树插件面板拖动后,画布区域未进行自适应缩放
Issue Number: N/A
What is the new behavior?
以下插件面板拖动后,画布区域自适应缩放
大纲树

页面 JS

页面 Schema

Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
Summary by CodeRabbit