Skip to content

Conversation

@emir-karabeg
Copy link
Collaborator

Summary

Adjusts the default spacing for newly added and duplicated workflow blocks, as well as auto-layout, to place them closer together. This change reduces the horizontal offset from 250px to 200px and centralizes these values in a new NEW_BLOCK_OFFSET constant for consistency and easier future adjustments.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

The changes were verified by running lint and type checks. Reviewers can observe the new block placement when duplicating blocks or adding new blocks to the canvas.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Screenshots/Videos


Open in Cursor Open in Web

Reduces the horizontal spacing between blocks from 250px to 200px (20% closer)
and centralizes the new block offset constants for consistent positioning
across the codebase.
@cursor
Copy link

cursor bot commented Dec 23, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@vercel
Copy link

vercel bot commented Dec 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Review Updated (UTC)
docs Skipped Skipped Dec 23, 2025 7:12am

*/
export const NEW_BLOCK_OFFSET = {
/** Horizontal offset from source block */
X: 200,

Choose a reason for hiding this comment

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

Hằng xuất khẩu NEW_BLOCK_OFFSET:
X: 200 (offset ngang từ block nguồn)
Y: 20 (offset dọc từ block nguồn)
Khai báo với as const để giữ giá trị dạng literal/readonly.

import { create } from 'zustand'
import { devtools } from 'zustand/middleware'
import { createLogger } from '@/lib/logs/console/logger'
import { NEW_BLOCK_OFFSET } from '@/lib/workflows/autolayout/constants'

Choose a reason for hiding this comment

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

Thay vì dùng 250 và 20 cố định, code giờ dùng giá trị từ một hằng số tập trung (NEW_BLOCK_OFFSET). Điều này làm cho offset khi tạo block mới có thể điều chỉnh/đồng bộ từ một nơi duy nhất (dễ bảo trì, dễ thay đổi giao diện/autolayout)

const offsetPosition = {
x: sourceBlock.position.x + 250,
y: sourceBlock.position.y + 20,
x: sourceBlock.position.x + NEW_BLOCK_OFFSET.X,

Choose a reason for hiding this comment

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

Trước: vị trí mới được tính bằng các "magic numbers" cố định x: sourceBlock.position.x + 250 và y: sourceBlock.position.y + 20
Sau: các giá trị 250 và 20 được thay bằng NEW_BLOCK_OFFSET.X và NEW_BLOCK_OFFSET.Y (và bạn thấy dòng import mới: import { NEW_BLOCK_OFFSET } from '@/lib/workflows/autolayout/constants')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants