mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-28 21:32:01 +08:00
feat(stage,editor): 添加disabledDragStart配置,用于关闭按下鼠标并拖动功能
This commit is contained in:
parent
c3888bedf2
commit
dd8ac99d5d
@ -218,6 +218,10 @@ export default defineComponent({
|
|||||||
updateDragEl: {
|
updateDragEl: {
|
||||||
type: Function as PropType<UpdateDragEl>,
|
type: Function as PropType<UpdateDragEl>,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
disabledDragStart: {
|
||||||
|
type: Boolean,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
emits: ['props-panel-mounted', 'update:modelValue'],
|
emits: ['props-panel-mounted', 'update:modelValue'],
|
||||||
@ -351,6 +355,7 @@ export default defineComponent({
|
|||||||
containerHighlightClassName: props.containerHighlightClassName,
|
containerHighlightClassName: props.containerHighlightClassName,
|
||||||
containerHighlightDuration: props.containerHighlightDuration,
|
containerHighlightDuration: props.containerHighlightDuration,
|
||||||
containerHighlightType: props.containerHighlightType,
|
containerHighlightType: props.containerHighlightType,
|
||||||
|
disabledDragStart: props.disabledDragStart,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ export interface StageOptions {
|
|||||||
containerHighlightClassName: string;
|
containerHighlightClassName: string;
|
||||||
containerHighlightDuration: number;
|
containerHighlightDuration: number;
|
||||||
containerHighlightType: ContainerHighlightType;
|
containerHighlightType: ContainerHighlightType;
|
||||||
|
disabledDragStart?: boolean;
|
||||||
render: (stage: StageCore) => HTMLDivElement | Promise<HTMLDivElement>;
|
render: (stage: StageCore) => HTMLDivElement | Promise<HTMLDivElement>;
|
||||||
moveableOptions: MoveableOptions | ((config?: CustomizeMoveableOptionsCallbackConfig) => MoveableOptions);
|
moveableOptions: MoveableOptions | ((config?: CustomizeMoveableOptionsCallbackConfig) => MoveableOptions);
|
||||||
canSelect: (el: HTMLElement) => boolean | Promise<boolean>;
|
canSelect: (el: HTMLElement) => boolean | Promise<boolean>;
|
||||||
|
@ -26,6 +26,7 @@ export const useStage = (stageOptions: StageOptions) => {
|
|||||||
containerHighlightClassName: stageOptions.containerHighlightClassName,
|
containerHighlightClassName: stageOptions.containerHighlightClassName,
|
||||||
containerHighlightDuration: stageOptions.containerHighlightDuration,
|
containerHighlightDuration: stageOptions.containerHighlightDuration,
|
||||||
containerHighlightType: stageOptions.containerHighlightType,
|
containerHighlightType: stageOptions.containerHighlightType,
|
||||||
|
disabledDragStart: stageOptions.disabledDragStart,
|
||||||
canSelect: (el, event, stop) => {
|
canSelect: (el, event, stop) => {
|
||||||
const elCanSelect = stageOptions.canSelect(el);
|
const elCanSelect = stageOptions.canSelect(el);
|
||||||
// 在组件联动过程中不能再往下选择,返回并触发 ui-select
|
// 在组件联动过程中不能再往下选择,返回并触发 ui-select
|
||||||
|
@ -102,6 +102,7 @@ export default class ActionManager extends EventEmitter {
|
|||||||
|
|
||||||
this.dr = new StageDragResize({
|
this.dr = new StageDragResize({
|
||||||
container: config.container,
|
container: config.container,
|
||||||
|
disabledDragStart: config.disabledDragStart,
|
||||||
getRootContainer: config.getRootContainer,
|
getRootContainer: config.getRootContainer,
|
||||||
getRenderDocument: config.getRenderDocument,
|
getRenderDocument: config.getRenderDocument,
|
||||||
updateDragEl: config.updateDragEl,
|
updateDragEl: config.updateDragEl,
|
||||||
|
@ -241,6 +241,7 @@ export default class StageCore extends EventEmitter {
|
|||||||
moveableOptions: config.moveableOptions,
|
moveableOptions: config.moveableOptions,
|
||||||
multiMoveableOptions: config.multiMoveableOptions,
|
multiMoveableOptions: config.multiMoveableOptions,
|
||||||
container: this.mask.content,
|
container: this.mask.content,
|
||||||
|
disabledDragStart: config.disabledDragStart,
|
||||||
canSelect: config.canSelect,
|
canSelect: config.canSelect,
|
||||||
isContainer: config.isContainer,
|
isContainer: config.isContainer,
|
||||||
updateDragEl: config.updateDragEl,
|
updateDragEl: config.updateDragEl,
|
||||||
|
@ -38,6 +38,7 @@ export default class StageDragResize extends MoveableOptionsManager {
|
|||||||
/** 拖动状态 */
|
/** 拖动状态 */
|
||||||
private dragStatus: StageDragStatus = StageDragStatus.END;
|
private dragStatus: StageDragStatus = StageDragStatus.END;
|
||||||
private dragResizeHelper: DragResizeHelper;
|
private dragResizeHelper: DragResizeHelper;
|
||||||
|
private disabledDragStart?: boolean;
|
||||||
private getRenderDocument: GetRenderDocument;
|
private getRenderDocument: GetRenderDocument;
|
||||||
private markContainerEnd: MarkContainerEnd;
|
private markContainerEnd: MarkContainerEnd;
|
||||||
private delayedMarkContainer: DelayedMarkContainer;
|
private delayedMarkContainer: DelayedMarkContainer;
|
||||||
@ -48,6 +49,7 @@ export default class StageDragResize extends MoveableOptionsManager {
|
|||||||
this.getRenderDocument = config.getRenderDocument;
|
this.getRenderDocument = config.getRenderDocument;
|
||||||
this.markContainerEnd = config.markContainerEnd;
|
this.markContainerEnd = config.markContainerEnd;
|
||||||
this.delayedMarkContainer = config.delayedMarkContainer;
|
this.delayedMarkContainer = config.delayedMarkContainer;
|
||||||
|
this.disabledDragStart = config.disabledDragStart;
|
||||||
|
|
||||||
this.dragResizeHelper = new DragResizeHelper({
|
this.dragResizeHelper = new DragResizeHelper({
|
||||||
container: config.container,
|
container: config.container,
|
||||||
@ -75,7 +77,7 @@ export default class StageDragResize extends MoveableOptionsManager {
|
|||||||
this.updateMoveable(el);
|
this.updateMoveable(el);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event) {
|
if (event && !this.disabledDragStart) {
|
||||||
this.moveable?.dragStart(event);
|
this.moveable?.dragStart(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,7 @@ export interface StageCoreConfig {
|
|||||||
render?: (renderer: StageCore) => Promise<HTMLElement> | HTMLElement;
|
render?: (renderer: StageCore) => Promise<HTMLElement> | HTMLElement;
|
||||||
autoScrollIntoView?: boolean;
|
autoScrollIntoView?: boolean;
|
||||||
updateDragEl?: UpdateDragEl;
|
updateDragEl?: UpdateDragEl;
|
||||||
|
disabledDragStart?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ActionManagerConfig {
|
export interface ActionManagerConfig {
|
||||||
@ -79,6 +80,7 @@ export interface ActionManagerConfig {
|
|||||||
containerHighlightType?: ContainerHighlightType;
|
containerHighlightType?: ContainerHighlightType;
|
||||||
moveableOptions?: CustomizeMoveableOptions;
|
moveableOptions?: CustomizeMoveableOptions;
|
||||||
multiMoveableOptions?: CustomizeMoveableOptions;
|
multiMoveableOptions?: CustomizeMoveableOptions;
|
||||||
|
disabledDragStart?: boolean;
|
||||||
canSelect?: CanSelect;
|
canSelect?: CanSelect;
|
||||||
isContainer: IsContainer;
|
isContainer: IsContainer;
|
||||||
getRootContainer: GetRootContainer;
|
getRootContainer: GetRootContainer;
|
||||||
@ -111,6 +113,7 @@ export interface StageMaskConfig {
|
|||||||
export interface StageDragResizeConfig {
|
export interface StageDragResizeConfig {
|
||||||
container: HTMLElement;
|
container: HTMLElement;
|
||||||
moveableOptions?: CustomizeMoveableOptions;
|
moveableOptions?: CustomizeMoveableOptions;
|
||||||
|
disabledDragStart?: boolean;
|
||||||
getRootContainer: GetRootContainer;
|
getRootContainer: GetRootContainer;
|
||||||
getRenderDocument: GetRenderDocument;
|
getRenderDocument: GetRenderDocument;
|
||||||
markContainerEnd: MarkContainerEnd;
|
markContainerEnd: MarkContainerEnd;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user