mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-05 07:39:48 +08:00
refactor(stage): 添加注释
This commit is contained in:
parent
d84037e421
commit
ab4eaad0b7
@ -28,9 +28,13 @@ import StageCore from './StageCore';
|
|||||||
import type { Offset, Runtime, SortEventData, StageDragResizeConfig } from './types';
|
import type { Offset, Runtime, SortEventData, StageDragResizeConfig } from './types';
|
||||||
import { getAbsolutePosition, getMode, getOffset } from './util';
|
import { getAbsolutePosition, getMode, getOffset } from './util';
|
||||||
|
|
||||||
|
/** 拖动状态 */
|
||||||
enum ActionStatus {
|
enum ActionStatus {
|
||||||
|
/** 开始拖动 */
|
||||||
START = 'start',
|
START = 'start',
|
||||||
|
/** 拖动中 */
|
||||||
ING = 'ing',
|
ING = 'ing',
|
||||||
|
/** 拖动结束 */
|
||||||
END = 'end',
|
END = 'end',
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,17 +43,27 @@ enum ActionStatus {
|
|||||||
*/
|
*/
|
||||||
export default class StageDragResize extends EventEmitter {
|
export default class StageDragResize extends EventEmitter {
|
||||||
public core: StageCore;
|
public core: StageCore;
|
||||||
|
/** 画布容器 */
|
||||||
public container: HTMLElement;
|
public container: HTMLElement;
|
||||||
|
/** 目标节点 */
|
||||||
public target?: HTMLElement;
|
public target?: HTMLElement;
|
||||||
|
/** 目标节点在蒙层中的占位节点 */
|
||||||
public dragEl: HTMLElement;
|
public dragEl: HTMLElement;
|
||||||
|
/** Moveable拖拽类实例 */
|
||||||
public moveable?: Moveable;
|
public moveable?: Moveable;
|
||||||
|
/** 水平参考线 */
|
||||||
public horizontalGuidelines: number[] = [];
|
public horizontalGuidelines: number[] = [];
|
||||||
|
/** 垂直参考线 */
|
||||||
public verticalGuidelines: number[] = [];
|
public verticalGuidelines: number[] = [];
|
||||||
|
/** 对齐元素集合 */
|
||||||
public elementGuidelines: HTMLElement[] = [];
|
public elementGuidelines: HTMLElement[] = [];
|
||||||
|
/** 布局方式:流式布局、绝对定位、固定定位 */
|
||||||
public mode: Mode = Mode.ABSOLUTE;
|
public mode: Mode = Mode.ABSOLUTE;
|
||||||
|
|
||||||
private moveableOptions: MoveableOptions = {};
|
private moveableOptions: MoveableOptions = {};
|
||||||
|
/** 拖动状态 */
|
||||||
private dragStatus: ActionStatus = ActionStatus.END;
|
private dragStatus: ActionStatus = ActionStatus.END;
|
||||||
|
/** 流式布局下,目标节点的镜像节点 */
|
||||||
private ghostEl: HTMLElement | undefined;
|
private ghostEl: HTMLElement | undefined;
|
||||||
private moveableHelper?: MoveableHelper;
|
private moveableHelper?: MoveableHelper;
|
||||||
|
|
||||||
|
@ -16,36 +16,53 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// 流式布局下拖动时需要clone一个镜像节点,镜像节点的id前缀
|
/** 流式布局下拖动时需要clone一个镜像节点,镜像节点的id前缀 */
|
||||||
export const GHOST_EL_ID_PREFIX = 'ghost_el_';
|
export const GHOST_EL_ID_PREFIX = 'ghost_el_';
|
||||||
|
|
||||||
|
/** 拖动的时候需要在蒙层中创建一个占位节点,该节点的id前缀 */
|
||||||
export const DRAG_EL_ID_PREFIX = 'drag_el_';
|
export const DRAG_EL_ID_PREFIX = 'drag_el_';
|
||||||
|
|
||||||
|
/** 高亮事需要在蒙层中创建一个占位节点,该节点的id前缀 */
|
||||||
export const HIGHLIGHT_EL_ID_PREFIX = 'highlight_el_';
|
export const HIGHLIGHT_EL_ID_PREFIX = 'highlight_el_';
|
||||||
|
|
||||||
// 默认放到缩小倍数
|
/** 默认放到缩小倍数 */
|
||||||
export const DEFAULT_ZOOM = 1;
|
export const DEFAULT_ZOOM = 1;
|
||||||
|
|
||||||
|
/** 参考线类型 */
|
||||||
export enum GuidesType {
|
export enum GuidesType {
|
||||||
|
/** 水平 */
|
||||||
HORIZONTAL = 'horizontal',
|
HORIZONTAL = 'horizontal',
|
||||||
|
/** 垂直 */
|
||||||
VERTICAL = 'vertical',
|
VERTICAL = 'vertical',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** css z-index */
|
||||||
export enum ZIndex {
|
export enum ZIndex {
|
||||||
|
/** 蒙层,用于监听用户操作,需要置于顶层 */
|
||||||
MASK = '99999',
|
MASK = '99999',
|
||||||
|
/** 选中的节点 */
|
||||||
SELECTED_EL = '666',
|
SELECTED_EL = '666',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 鼠标按键 */
|
||||||
export enum MouseButton {
|
export enum MouseButton {
|
||||||
|
/** 左键 */
|
||||||
LEFT = 0,
|
LEFT = 0,
|
||||||
|
/** z中健 */
|
||||||
MIDDLE = 1,
|
MIDDLE = 1,
|
||||||
|
/** 右键 */
|
||||||
RIGHT = 2,
|
RIGHT = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 布局方式 */
|
||||||
export enum Mode {
|
export enum Mode {
|
||||||
|
/** 绝对定位布局 */
|
||||||
ABSOLUTE = 'absolute',
|
ABSOLUTE = 'absolute',
|
||||||
|
/** 固定定位布局 */
|
||||||
FIXED = 'fixed',
|
FIXED = 'fixed',
|
||||||
|
/** 流式布局 */
|
||||||
SORTABLE = 'sortable',
|
SORTABLE = 'sortable',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 选中节点的class name */
|
||||||
export const SELECTED_CLASS = 'tmagic-stage-selected-area';
|
export const SELECTED_CLASS = 'tmagic-stage-selected-area';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user