优化,排列
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
alignToSelectionBounds,
|
||||
alignSelectionToCanvas,
|
||||
tileSelectedEvenly,
|
||||
tileSelectedFlush,
|
||||
type AlignMode,
|
||||
} from '../elementAlign';
|
||||
import { CollapsiblePanelSection } from './CollapsiblePanelSection';
|
||||
@@ -44,6 +45,8 @@ import {
|
||||
AlignVerticalJustifyEnd,
|
||||
AlignHorizontalSpaceBetween,
|
||||
AlignVerticalSpaceBetween,
|
||||
Columns2,
|
||||
Rows2,
|
||||
Link2,
|
||||
Plus,
|
||||
Ruler,
|
||||
@@ -232,10 +235,12 @@ export const PropSidebar: React.FC<PropSidebarProps> = ({
|
||||
});
|
||||
};
|
||||
|
||||
const applyTile = (axis: 'horizontal' | 'vertical') => {
|
||||
const applyTile = (axis: 'horizontal' | 'vertical', spacing: 'even' | 'none' = 'even') => {
|
||||
const tile =
|
||||
spacing === 'even' ? tileSelectedEvenly : tileSelectedFlush;
|
||||
onChangeTemplate({
|
||||
...template,
|
||||
elements: tileSelectedEvenly(template.elements, selectedElementIds, axis),
|
||||
elements: tile(template.elements, selectedElementIds, axis),
|
||||
});
|
||||
};
|
||||
|
||||
@@ -760,6 +765,18 @@ export const PropSidebar: React.FC<PropSidebarProps> = ({
|
||||
title="在选区高度内垂直等距排列"
|
||||
onClick={() => applyTile('vertical')}
|
||||
/>
|
||||
<AlignToolButton
|
||||
icon={<Columns2 className="w-3.5 h-3.5" />}
|
||||
label="水平无间距平铺"
|
||||
title="从最左元素起水平紧密排列"
|
||||
onClick={() => applyTile('horizontal', 'none')}
|
||||
/>
|
||||
<AlignToolButton
|
||||
icon={<Rows2 className="w-3.5 h-3.5" />}
|
||||
label="垂直无间距平铺"
|
||||
title="从最上元素起垂直紧密排列"
|
||||
onClick={() => applyTile('vertical', 'none')}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1348,7 +1365,6 @@ export const PropSidebar: React.FC<PropSidebarProps> = ({
|
||||
onClick={() =>
|
||||
handleElemChange({
|
||||
...selectedElem,
|
||||
backgroundColor: 'transparent',
|
||||
backgroundOpacity: 0,
|
||||
})
|
||||
}
|
||||
@@ -1430,7 +1446,6 @@ export const PropSidebar: React.FC<PropSidebarProps> = ({
|
||||
if (op <= 0) {
|
||||
handleElemChange({
|
||||
...selectedElem,
|
||||
backgroundColor: 'transparent',
|
||||
backgroundOpacity: 0,
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user