From 10e2147423a74d1037af0d32a69a81412467e7cb Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Thu, 6 Feb 2025 09:49:07 +0800 Subject: [PATCH] feat: support snap transform by view --- .../character/table/runtime/row-visible.ts | 2 +- .../edit-control/transform-control.ts | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/packages/vstory-core/src/character/table/runtime/row-visible.ts b/packages/vstory-core/src/character/table/runtime/row-visible.ts index 3c44aafa..600a25af 100644 --- a/packages/vstory-core/src/character/table/runtime/row-visible.ts +++ b/packages/vstory-core/src/character/table/runtime/row-visible.ts @@ -18,7 +18,7 @@ export class RowVisibleRuntime implements ITableCharacterRuntime { const records: any[] = []; const headerRowVisible = options.rowVisible[-1]; spec.showHeader = headerRowVisible !== false && options.showHeader !== false; - options.spec.records.forEach((record, index) => { + options.spec.records.forEach((record: any, index: number) => { const rowVisible = options.rowVisible[index]; if (rowVisible === false) { return; diff --git a/packages/vstory-editor/src/selection/edit-control/transform-control.ts b/packages/vstory-editor/src/selection/edit-control/transform-control.ts index 34314d49..445bced4 100644 --- a/packages/vstory-editor/src/selection/edit-control/transform-control.ts +++ b/packages/vstory-editor/src/selection/edit-control/transform-control.ts @@ -141,6 +141,20 @@ export class TransformController extends AbstractComponent { const d1 = abs(item.value - bounds[`${orient}1`]); const d2 = abs(item.value - bounds[`${orient}2`]); // 中间的线 const d3 = abs(item.value - (bounds[`${orient}1`] + bounds[`${orient}2`]) / 2); - return d1 < this._snapThreshold || d2 < this._snapThreshold || d3 < this._snapThreshold; + return d1 < transformedSnapThreshold || d2 < transformedSnapThreshold || d3 < transformedSnapThreshold; }); if (!snapLines.length) { return false;