mirror of
https://gitee.com/ByteDance/flowgram.ai.git
synced 2025-07-07 17:43:29 +08:00
feat(fixed-layout): add ConstantKeys.BRANCH_SPACING (#413)
This commit is contained in:
parent
099fd445f2
commit
629a9e564f
@ -91,6 +91,7 @@ export function useEditorProps(
|
||||
*/
|
||||
constants: {
|
||||
// [ConstantKeys.NODE_SPACING]: 24,
|
||||
// [ConstantKeys.BRANCH_SPACING]: 20,
|
||||
// [ConstantKeys.INLINE_SPACING_BOTTOM]: 24,
|
||||
// [ConstantKeys.INLINE_BLOCKS_INLINE_SPACING_BOTTOM]: 13,
|
||||
// [ConstantKeys.ROUNDED_LINE_X_RADIUS]: 8,
|
||||
|
||||
@ -56,6 +56,10 @@ export const DefaultSpacingKey = {
|
||||
* 普通节点间距。垂直 / 水平
|
||||
*/
|
||||
NODE_SPACING: 'SPACING',
|
||||
/**
|
||||
* 分支节点间距
|
||||
*/
|
||||
BRANCH_SPACING: 'BRANCH_SPACING',
|
||||
/**
|
||||
* 圆弧线条 x radius
|
||||
*/
|
||||
@ -85,7 +89,11 @@ export const DefaultSpacingKey = {
|
||||
export const DEFAULT_SPACING = {
|
||||
NULL: 0,
|
||||
[DefaultSpacingKey.NODE_SPACING]: 32, // 普通节点间距。垂直 / 水平
|
||||
MARGIN_RIGHT: 20, // 普通节点右边间距
|
||||
[DefaultSpacingKey.BRANCH_SPACING]: 20, // 分支节点间距
|
||||
/**
|
||||
* @deprecated use 'BRANCH_SPACING' instead
|
||||
*/
|
||||
MARGIN_RIGHT: 20, // 分支节点右边间距
|
||||
INLINE_BLOCK_PADDING_BOTTOM: 16, // block 底部留白
|
||||
INLINE_BLOCKS_PADDING_TOP: 30, // block list 上部留白间距
|
||||
[DefaultSpacingKey.INLINE_BLOCKS_PADDING_BOTTOM]: 40, // block lit 下部留白间距,因为有两个拐弯,所以翻一倍
|
||||
|
||||
@ -43,7 +43,7 @@ export const InlineBlocksRegistry: FlowNodeRegistry = {
|
||||
// 如果小于最小宽度,偏移最小宽度的距离
|
||||
const delta = Math.max(
|
||||
child.parent!.minInlineBlockSpacing - leftSpacing,
|
||||
DEFAULT_SPACING.MARGIN_RIGHT - child.originDeltaX
|
||||
getDefaultSpacing(child.entity, ConstantKeys.BRANCH_SPACING) - child.originDeltaX
|
||||
);
|
||||
|
||||
return {
|
||||
@ -57,7 +57,7 @@ export const InlineBlocksRegistry: FlowNodeRegistry = {
|
||||
// 如果小于最小高度,偏移最小高度的距离
|
||||
const delta = Math.max(
|
||||
child.parent!.minInlineBlockSpacing - bottomSpacing,
|
||||
DEFAULT_SPACING.MARGIN_RIGHT - child.originDeltaY
|
||||
getDefaultSpacing(child.entity, ConstantKeys.BRANCH_SPACING) - child.originDeltaY
|
||||
);
|
||||
|
||||
return {
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
import { FlowRendererKey, FlowTextKey } from '@flowgram.ai/renderer';
|
||||
import {
|
||||
DEFAULT_SPACING,
|
||||
FlowNodeBaseType,
|
||||
type FlowNodeRegistry,
|
||||
FlowNodeTransformData,
|
||||
FlowTransitionLabelEnum,
|
||||
FlowTransitionLineEnum,
|
||||
FlowLayoutDefault,
|
||||
getDefaultSpacing,
|
||||
ConstantKeys,
|
||||
} from '@flowgram.ai/document';
|
||||
|
||||
import { TryCatchSpacings, TryCatchTypeEnum } from './constants';
|
||||
@ -118,12 +119,12 @@ export const MainInlineBlocksRegistry: FlowNodeRegistry = {
|
||||
if (isVertical) {
|
||||
delta = Math.max(
|
||||
child.parent!.minInlineBlockSpacing,
|
||||
-child.originDeltaX + DEFAULT_SPACING.MARGIN_RIGHT
|
||||
-child.originDeltaX + getDefaultSpacing(child.entity, ConstantKeys.BRANCH_SPACING)
|
||||
);
|
||||
} else {
|
||||
delta = Math.max(
|
||||
child.parent!.minInlineBlockSpacing,
|
||||
-child.originDeltaY + DEFAULT_SPACING.MARGIN_RIGHT
|
||||
-child.originDeltaY + getDefaultSpacing(child.entity, ConstantKeys.BRANCH_SPACING)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -68,4 +68,4 @@ export function ConditionRow({ style, value, onChange, readonly }: PropTypes) {
|
||||
);
|
||||
}
|
||||
|
||||
export { ConditionRowValueType };
|
||||
export { type ConditionRowValueType };
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user