mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
parent
9d24069dcd
commit
17101687bf
@ -19,9 +19,10 @@ import EventEmitter from 'events';
|
||||
|
||||
import KeyController from 'keycon';
|
||||
import { throttle } from 'lodash-es';
|
||||
import type { MoveableOptions } from 'moveable';
|
||||
|
||||
import { Env } from '@tmagic/core';
|
||||
import { Id } from '@tmagic/schema';
|
||||
import type { Id } from '@tmagic/schema';
|
||||
import { addClassName, getDocument, removeClassNameByClassName } from '@tmagic/utils';
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 鼠标事件
|
||||
|
@ -36,6 +36,7 @@ export default class MoveableOptionsManager extends EventEmitter {
|
||||
|
||||
/** 画布容器 */
|
||||
protected container: HTMLElement;
|
||||
protected options: MoveableOptions = {};
|
||||
|
||||
/** 水平参考线 */
|
||||
private horizontalGuidelines: number[] = [];
|
||||
@ -55,6 +56,10 @@ export default class MoveableOptionsManager extends EventEmitter {
|
||||
this.getRootContainer = config.getRootContainer;
|
||||
}
|
||||
|
||||
public getOption<K extends keyof MoveableOptions>(key: K): MoveableOptions[K] {
|
||||
return this.options[key];
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置水平/垂直参考线
|
||||
* @param type 参考线类型
|
||||
@ -106,7 +111,8 @@ export default class MoveableOptionsManager extends EventEmitter {
|
||||
const defaultOptions = this.getDefaultOptions(isMultiSelect);
|
||||
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 { Id } from '@tmagic/schema';
|
||||
import type { MoveableOptions } from 'moveable';
|
||||
|
||||
import type { Id } from '@tmagic/schema';
|
||||
|
||||
import ActionManager from './ActionManager';
|
||||
import { DEFAULT_ZOOM } from './const';
|
||||
import StageMask from './StageMask';
|
||||
import StageRender from './StageRender';
|
||||
import {
|
||||
import type {
|
||||
ActionManagerConfig,
|
||||
CustomizeRender,
|
||||
GuidesEventData,
|
||||
@ -207,6 +209,10 @@ export default class StageCore extends EventEmitter {
|
||||
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