Fix drag connexion error

This commit is contained in:
Paulo Gustavo Veiga 2022-02-09 21:04:12 -08:00
parent d8b7fd81fa
commit 3bc5b3aa86
4 changed files with 8 additions and 8 deletions

View File

@ -137,8 +137,8 @@ class Designer extends Events {
}
private _registerWheelEvents(): void {
const zoomFactor = 1.006;
document.addEventListener('wheel', (event) => {
const zoomFactor = 1.02;
document.addEventListener('wheel', (event: WheelEvent) => {
if (event.deltaX > 0 || event.deltaY > 0) {
this.zoomOut(zoomFactor);
} else {

View File

@ -28,7 +28,7 @@ class RelationshipPivot {
private _designer: Designer;
private _mouseMoveEvent: MouseEvent;
private _mouseMoveEvent;
private _onClickEvent: (event: MouseEvent) => void;

View File

@ -113,11 +113,11 @@ class Workspace {
}
}
addEvent(type: string, listener): void {
addEvent(type: string, listener: (event: Event) => void): void {
this._workspace.addEvent(type, listener);
}
removeEvent(type: string, listener): void {
removeEvent(type: string, listener: (event: Event) => void): void {
$assert(type, 'type can not be null');
$assert(listener, 'listener can not be null');
this._workspace.removeEvent(type, listener);
@ -193,7 +193,7 @@ class Workspace {
const workspace = this._workspace;
const screenManager = this._screenManager;
const mWorkspace = this;
const mouseDownListener = function mouseDownListener(event) {
const mouseDownListener = function mouseDownListener(event: MouseEvent) {
if (!$defined(workspace._mouseMoveListener)) {
if (mWorkspace.isWorkspaceEventsEnabled()) {
mWorkspace.enableWorkspaceEvents(false);
@ -202,7 +202,7 @@ class Workspace {
const originalCoordOrigin = workspace.getCoordOrigin();
let wasDragged = false;
workspace._mouseMoveListener = (mouseMoveEvent) => {
workspace._mouseMoveListener = (mouseMoveEvent: MouseEvent) => {
const currentMousePosition = screenManager.getWorkspaceMousePosition(mouseMoveEvent);
const offsetX = currentMousePosition.x - mouseDownPosition.x;

View File

@ -76,7 +76,7 @@ class DragTopicCommand extends Command {
}
// Finally, connect topic ...
if (origParentTopic.getId() !== this._parentId) {
if (!$defined(origParentTopic) || origParentTopic.getId() !== this._parentId) {
if ($defined(this._parentId)) {
const parentTopic = commandContext.findTopics([this._parentId])[0];
commandContext.connect(topic, parentTopic);