mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 06:37:56 +01:00
Fix drag connexion error
This commit is contained in:
parent
d8b7fd81fa
commit
3bc5b3aa86
@ -137,8 +137,8 @@ class Designer extends Events {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _registerWheelEvents(): void {
|
private _registerWheelEvents(): void {
|
||||||
const zoomFactor = 1.006;
|
const zoomFactor = 1.02;
|
||||||
document.addEventListener('wheel', (event) => {
|
document.addEventListener('wheel', (event: WheelEvent) => {
|
||||||
if (event.deltaX > 0 || event.deltaY > 0) {
|
if (event.deltaX > 0 || event.deltaY > 0) {
|
||||||
this.zoomOut(zoomFactor);
|
this.zoomOut(zoomFactor);
|
||||||
} else {
|
} else {
|
||||||
|
@ -28,7 +28,7 @@ class RelationshipPivot {
|
|||||||
|
|
||||||
private _designer: Designer;
|
private _designer: Designer;
|
||||||
|
|
||||||
private _mouseMoveEvent: MouseEvent;
|
private _mouseMoveEvent;
|
||||||
|
|
||||||
private _onClickEvent: (event: MouseEvent) => void;
|
private _onClickEvent: (event: MouseEvent) => void;
|
||||||
|
|
||||||
|
@ -113,11 +113,11 @@ class Workspace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
addEvent(type: string, listener): void {
|
addEvent(type: string, listener: (event: Event) => void): void {
|
||||||
this._workspace.addEvent(type, listener);
|
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(type, 'type can not be null');
|
||||||
$assert(listener, 'listener can not be null');
|
$assert(listener, 'listener can not be null');
|
||||||
this._workspace.removeEvent(type, listener);
|
this._workspace.removeEvent(type, listener);
|
||||||
@ -193,7 +193,7 @@ class Workspace {
|
|||||||
const workspace = this._workspace;
|
const workspace = this._workspace;
|
||||||
const screenManager = this._screenManager;
|
const screenManager = this._screenManager;
|
||||||
const mWorkspace = this;
|
const mWorkspace = this;
|
||||||
const mouseDownListener = function mouseDownListener(event) {
|
const mouseDownListener = function mouseDownListener(event: MouseEvent) {
|
||||||
if (!$defined(workspace._mouseMoveListener)) {
|
if (!$defined(workspace._mouseMoveListener)) {
|
||||||
if (mWorkspace.isWorkspaceEventsEnabled()) {
|
if (mWorkspace.isWorkspaceEventsEnabled()) {
|
||||||
mWorkspace.enableWorkspaceEvents(false);
|
mWorkspace.enableWorkspaceEvents(false);
|
||||||
@ -202,7 +202,7 @@ class Workspace {
|
|||||||
const originalCoordOrigin = workspace.getCoordOrigin();
|
const originalCoordOrigin = workspace.getCoordOrigin();
|
||||||
|
|
||||||
let wasDragged = false;
|
let wasDragged = false;
|
||||||
workspace._mouseMoveListener = (mouseMoveEvent) => {
|
workspace._mouseMoveListener = (mouseMoveEvent: MouseEvent) => {
|
||||||
const currentMousePosition = screenManager.getWorkspaceMousePosition(mouseMoveEvent);
|
const currentMousePosition = screenManager.getWorkspaceMousePosition(mouseMoveEvent);
|
||||||
|
|
||||||
const offsetX = currentMousePosition.x - mouseDownPosition.x;
|
const offsetX = currentMousePosition.x - mouseDownPosition.x;
|
||||||
|
@ -76,7 +76,7 @@ class DragTopicCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Finally, connect topic ...
|
// Finally, connect topic ...
|
||||||
if (origParentTopic.getId() !== this._parentId) {
|
if (!$defined(origParentTopic) || origParentTopic.getId() !== this._parentId) {
|
||||||
if ($defined(this._parentId)) {
|
if ($defined(this._parentId)) {
|
||||||
const parentTopic = commandContext.findTopics([this._parentId])[0];
|
const parentTopic = commandContext.findTopics([this._parentId])[0];
|
||||||
commandContext.connect(topic, parentTopic);
|
commandContext.connect(topic, parentTopic);
|
||||||
|
Loading…
Reference in New Issue
Block a user