mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-05-09 20:19:21 +08:00
parent
9d24069dcd
commit
17101687bf
@ -19,9 +19,10 @@ import EventEmitter from 'events';
|
|||||||
|
|
||||||
import KeyController from 'keycon';
|
import KeyController from 'keycon';
|
||||||
import { throttle } from 'lodash-es';
|
import { throttle } from 'lodash-es';
|
||||||
|
import type { MoveableOptions } from 'moveable';
|
||||||
|
|
||||||
import { Env } from '@tmagic/core';
|
import { Env } from '@tmagic/core';
|
||||||
import { Id } from '@tmagic/schema';
|
import type { Id } from '@tmagic/schema';
|
||||||
import { addClassName, getDocument, removeClassNameByClassName } from '@tmagic/utils';
|
import { addClassName, getDocument, removeClassNameByClassName } from '@tmagic/utils';
|
||||||
|
|
||||||
import { CONTAINER_HIGHLIGHT_CLASS_NAME, GHOST_EL_ID_PREFIX, GuidesType, MouseButton, PAGE_CLASS } from './const';
|
import { CONTAINER_HIGHLIGHT_CLASS_NAME, GHOST_EL_ID_PREFIX, GuidesType, MouseButton, PAGE_CLASS } from './const';
|
||||||
@ -186,6 +187,15 @@ export default class ActionManager extends EventEmitter {
|
|||||||
return this.selectedElList;
|
return this.selectedElList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getMoveableOption<K extends keyof MoveableOptions>(key: K): MoveableOptions[K] | undefined {
|
||||||
|
if (this.dr.getTarget()) {
|
||||||
|
return this.dr.getOption(key);
|
||||||
|
}
|
||||||
|
if (this.multiDr.targetList.length) {
|
||||||
|
return this.multiDr.getOption(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取鼠标下方第一个可选中元素,如果元素层叠,返回到是最上层元素
|
* 获取鼠标下方第一个可选中元素,如果元素层叠,返回到是最上层元素
|
||||||
* @param event 鼠标事件
|
* @param event 鼠标事件
|
||||||
|
@ -36,6 +36,7 @@ export default class MoveableOptionsManager extends EventEmitter {
|
|||||||
|
|
||||||
/** 画布容器 */
|
/** 画布容器 */
|
||||||
protected container: HTMLElement;
|
protected container: HTMLElement;
|
||||||
|
protected options: MoveableOptions = {};
|
||||||
|
|
||||||
/** 水平参考线 */
|
/** 水平参考线 */
|
||||||
private horizontalGuidelines: number[] = [];
|
private horizontalGuidelines: number[] = [];
|
||||||
@ -55,6 +56,10 @@ export default class MoveableOptionsManager extends EventEmitter {
|
|||||||
this.getRootContainer = config.getRootContainer;
|
this.getRootContainer = config.getRootContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getOption<K extends keyof MoveableOptions>(key: K): MoveableOptions[K] {
|
||||||
|
return this.options[key];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置水平/垂直参考线
|
* 设置水平/垂直参考线
|
||||||
* @param type 参考线类型
|
* @param type 参考线类型
|
||||||
@ -106,7 +111,8 @@ export default class MoveableOptionsManager extends EventEmitter {
|
|||||||
const defaultOptions = this.getDefaultOptions(isMultiSelect);
|
const defaultOptions = this.getDefaultOptions(isMultiSelect);
|
||||||
const customizedOptions = this.getCustomizeOptions();
|
const customizedOptions = this.getCustomizeOptions();
|
||||||
|
|
||||||
return merge(defaultOptions, customizedOptions, runtimeOptions);
|
this.options = merge(defaultOptions, customizedOptions, runtimeOptions);
|
||||||
|
return this.options;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,13 +18,15 @@
|
|||||||
|
|
||||||
import { EventEmitter } from 'events';
|
import { EventEmitter } from 'events';
|
||||||
|
|
||||||
import { Id } from '@tmagic/schema';
|
import type { MoveableOptions } from 'moveable';
|
||||||
|
|
||||||
|
import type { Id } from '@tmagic/schema';
|
||||||
|
|
||||||
import ActionManager from './ActionManager';
|
import ActionManager from './ActionManager';
|
||||||
import { DEFAULT_ZOOM } from './const';
|
import { DEFAULT_ZOOM } from './const';
|
||||||
import StageMask from './StageMask';
|
import StageMask from './StageMask';
|
||||||
import StageRender from './StageRender';
|
import StageRender from './StageRender';
|
||||||
import {
|
import type {
|
||||||
ActionManagerConfig,
|
ActionManagerConfig,
|
||||||
CustomizeRender,
|
CustomizeRender,
|
||||||
GuidesEventData,
|
GuidesEventData,
|
||||||
@ -207,6 +209,10 @@ export default class StageCore extends EventEmitter {
|
|||||||
return this.actionManager.delayedMarkContainer(event, excludeElList);
|
return this.actionManager.delayedMarkContainer(event, excludeElList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getMoveableOption<K extends keyof MoveableOptions>(key: K): MoveableOptions[K] | undefined {
|
||||||
|
return this.actionManager.getMoveableOption(key);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 销毁实例
|
* 销毁实例
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user