diff --git a/packages/core/src/commands/config/config.ts b/packages/core/src/commands/config/config.ts index 782dc63d5..3f1822bb3 100644 --- a/packages/core/src/commands/config/config.ts +++ b/packages/core/src/commands/config/config.ts @@ -57,18 +57,7 @@ const config: () => CommandsConfig = () => ({ stylePrefix: 'com-', defaults: {}, strict: true, - defaultOptions: { - 'core:component-drag': { - run: (options: CommandOptions) => ({ - ...options, - // skipGuidesRender: true, - // debug: true, - // addStyle({ component, styles, partial }) { - // component.addStyle(styles, { partial }); - // }, - }), - }, - }, + defaultOptions: {}, }); export default config; diff --git a/packages/core/src/commands/view/ComponentDrag.ts b/packages/core/src/commands/view/ComponentDrag.ts index 082db665e..72298a6c1 100644 --- a/packages/core/src/commands/view/ComponentDrag.ts +++ b/packages/core/src/commands/view/ComponentDrag.ts @@ -609,6 +609,7 @@ type ComponentDragOpts = { onDrag?: (data: any) => Editor; onEnd?: (ev: Event, opt: any, data: any) => void; }; + /** * Represents the properties of the drag events. */ @@ -695,20 +696,50 @@ type Guide = { guideEl?: HTMLElement; /** * Indicates whether the guide is active. - * @todo Check if this property is used. The `active` property is not set in the code, but the value is changing. + * @todo The `active` property is not set in the code, but the value is changing. */ active?: boolean; }; +/** + * Represents a matched guide during component dragging. + */ type GuideMatched = { - guide: Guide; + /** + * The static guides used for matching. + */ guidesStatic: Guide[]; + /** + * The origin component guide. + */ + guide: Guide; + /** + * The matched component guide. + */ matched: Guide; + /** + * The primary position of the guide (either x or y depending on the axis). + */ posFirst: number; + /** + * The secondary position of the guide (the opposite axis of posFirst). + */ posSecond: number; + /** + * The distance between the two matched guides. + */ size: number; + /** + * The raw distance between the two matched guides. + */ sizeRaw: number; + /** + * The HTML element representing the guide info (line between the guides). + */ elGuideInfo: HTMLElement; + /** + * The container element for the guide info (text content of the line). + */ elGuideInfoCnt: HTMLElement; };