Skip to content

fix: divider of CanvasDivider position error#1233

Merged
hexqi merged 1 commit intoopentiny:developfrom
gene9831:fix/divider-line-px
Mar 21, 2025
Merged

fix: divider of CanvasDivider position error#1233
hexqi merged 1 commit intoopentiny:developfrom
gene9831:fix/divider-line-px

Conversation

@gene9831
Copy link
Collaborator

@gene9831 gene9831 commented Mar 20, 2025

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

What is the current behavior?

画布行列容器,鼠标悬停剪刀图标时,分割线不显示

What is the new behavior?

画布行列容器,鼠标悬停剪刀图标时,分割线显示

image image

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Refactor
    • Revised divider styling to apply positional values directly, ensuring a smoother and more consistent layout.
  • Bug Fixes
    • Enhanced selection interaction by defaulting optional settings, preventing potential issues during unsupported configurations.

These improvements contribute to a more robust and reliable user experience with consistent visual rendering and stable interactions.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 20, 2025

Walkthrough

This pull request makes two focused changes in the canvas container project. In CanvasDivider.vue, several state properties are altered from numeric to string types, affecting how style values are applied. In container.ts, the setSelectRect function now defaults its options parameter to an empty object and refines the extraction of the schema, streamlining the assignment of componentName. The overall component logic remains consistent while improving parameter handling and type definitions.

Changes

File(s) Change Summary
packages/canvas/.../CanvasDivider.vue Updated state properties (horizontalLeft, horizontalTop, verLeft, verTop) from numbers (0) to empty strings (''), impacting style bindings and removing obsolete comments.
packages/canvas/.../container.ts Modified setSelectRect to default the options parameter to {} and refined the schema extraction logic to simplify componentName assignment.

Possibly related PRs

  • fix: canvasDivider can't work #1075 – Related to component functionality in CanvasDivider.vue, introducing methods like handleSplit and handleSplitRow that interact with similar state management.

Suggested labels

refactor-main

Suggested reviewers

  • rhlin
  • chilingling

Poem

I'm a rabbit, hopping with cheer,
Changes in code bring springtime near.
Strings replace numbers in a simple twist,
And defaults in functions can't be missed.
With gentle hops, I celebrate the day—
Code blooms like carrots along the way!

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the bug Something isn't working label Mar 20, 2025
@gene9831
Copy link
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 20, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3739ce2 and b16d3d4.

📒 Files selected for processing (2)
  • packages/canvas/container/src/components/CanvasDivider.vue (2 hunks)
  • packages/canvas/container/src/container.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
packages/canvas/container/src/components/CanvasDivider.vue (1)
Learnt from: gene9831
PR: opentiny/tiny-engine#1226
File: packages/canvas/container/src/components/CanvasDivider.vue:184-185
Timestamp: 2025-03-20T06:35:04.971Z
Learning: The CSS bug in packages/canvas/container/src/components/CanvasDivider.vue where verLeft already includes "px" but is being appended again in the style object will be fixed in a future update, as confirmed by gene9831.
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: push-check
🔇 Additional comments (4)
packages/canvas/container/src/container.ts (3)

393-393: Good defensive programming with default parameter

Adding a default empty object for the options parameter prevents potential errors when the function is called without passing the options argument.


396-397: Improved schema handling logic

The refactored code provides better fallback logic for retrieving the schema, ensuring the function works correctly even when schema isn't provided in the options.


401-401: Simplified componentName extraction

Directly accessing schema?.componentName simplifies the code and makes it more readable while maintaining the same functionality.

packages/canvas/container/src/components/CanvasDivider.vue (1)

228-230:

Details

✅ Verification successful

Verify CSS v-bind behavior with string variables

Ensure that the v-bind in the CSS rules works correctly with the state variables now being empty strings initially. The change from numbers to strings in the reactive state shouldn't affect the v-bind functionality, but it's good to verify.


🏁 Script executed:

#!/bin/bash
# Verify if there are other instances of v-bind with similar pattern in the codebase
rg "v-bind\('state\..*'\)" -g "*.vue" 

Length of output: 1261


Review Approval: CSS v-bind Usage Verified

The search confirms that the v-bind pattern is consistently used across similar Vue components. In particular, the usage of v-bind with state properties—even when these state variables initialize as empty strings—is uniform (e.g., with 'state.top', 'state.left', 'state.verTop', etc.). This consistency supports that changing from numbers to strings in the reactive state should not break the CSS binding behavior. Please still ensure through runtime checks that the empty string values render as expected in the UI.

@gene9831 gene9831 marked this pull request as ready for review March 20, 2025 07:31
@gene9831 gene9831 changed the title fix: CanvasDivider position error fix: divider of CanvasDivider position error Mar 20, 2025
@hexqi hexqi merged commit bf99814 into opentiny:develop Mar 21, 2025
4 checks passed
@gene9831 gene9831 deleted the fix/divider-line-px branch May 7, 2025 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants