fix: error when dragging in outline view

This commit is contained in:
JackLian 2023-01-03 18:36:44 +08:00 committed by 刘菊萍(絮黎)
parent 9444752a65
commit b7d32fe8a1
4 changed files with 80 additions and 7 deletions

View File

@ -0,0 +1,54 @@
---
title: DropLocation
sidebar_position: 13
---
> **@types** [IPublicModelDropLocation](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/drop-location.ts)<br/>
> **@since** v1.1.0
## 基本介绍
拖拽放置位置模型
## 变量
### target
拖拽放置位置目标
`@type {IPublicModelNode}`
相关类型:[IPublicModelNode](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/node.ts)
### detail
拖拽放置位置详情
`@type {IPublicTypeLocationDetail}`
相关类型:[IPublicTypeLocationDetail](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/type/location-detail.ts)
### event
拖拽放置位置对应的事件
`@type {IPublicTypeLocationDetail}`
相关类型:[IPublicModelLocateEvent](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/location-event.ts)
## 方法签名
### clone
获取一份当前对象的克隆
```typescript
/**
* 获取一份当前对象的克隆
* get a clone object of current dropLocation
*/
clone(event: IPublicModelLocateEvent): IPublicModelDropLocation;
```
相关类型:[IPublicModelLocateEvent](https://github.com/alibaba/lowcode-engine/blob/main/packages/types/src/shell/model/location-event.ts)

View File

@ -101,10 +101,6 @@ export function getWindow(elem: Element | Document): Window {
} }
export interface IDropLocation extends IPublicModelDropLocation { export interface IDropLocation extends IPublicModelDropLocation {
readonly target: INode;
readonly event: ILocateEvent;
readonly source: string; readonly source: string;
get document(): IPublicModelDocumentModel; get document(): IPublicModelDocumentModel;

View File

@ -27,6 +27,10 @@ export class DropLocation implements IPublicModelDropLocation {
return this[dropLocationSymbol].detail; return this[dropLocationSymbol].detail;
} }
get event(): IPublicModelLocateEvent {
return this[dropLocationSymbol].event;
}
clone(event: IPublicModelLocateEvent): IPublicModelDropLocation { clone(event: IPublicModelLocateEvent): IPublicModelDropLocation {
return new DropLocation(this[dropLocationSymbol].clone(event)); return new DropLocation(this[dropLocationSymbol].clone(event));
} }

View File

@ -1,10 +1,29 @@
import { IPublicTypeLocationDetail } from '../type'; import { IPublicTypeLocationDetail } from '../type';
import { IPublicModelLocateEvent } from './'; import { IPublicModelLocateEvent, IPublicModelNode } from './';
export interface IPublicModelDropLocation { export interface IPublicModelDropLocation {
get target(): any;
readonly detail: IPublicTypeLocationDetail; /**
*
* get target of dropLocation
*/
get target(): IPublicModelNode;
/**
*
* get detail of dropLocation
*/
get detail(): IPublicTypeLocationDetail;
/**
*
* get event of dropLocation
*/
get event(): IPublicModelLocateEvent;
/**
*
* get a clone object of current dropLocation
*/
clone(event: IPublicModelLocateEvent): IPublicModelDropLocation; clone(event: IPublicModelLocateEvent): IPublicModelDropLocation;
} }