Fix lint error

This commit is contained in:
Paulo Gustavo Veiga 2022-02-09 19:44:55 -08:00
parent 1a8ffee801
commit 2e191a168a
5 changed files with 33 additions and 15 deletions

View File

@ -17,9 +17,25 @@
*/ */
import { $assert, $defined } from '@wisemapping/core-js'; import { $assert, $defined } from '@wisemapping/core-js';
import DragTopic from './DragTopic'; import DragTopic from './DragTopic';
import EventBusDispatcher from './layout/EventBusDispatcher';
import Workspace from './Workspace';
class DragManager { class DragManager {
constructor(workspace, eventDispatcher) { private _workspace: Workspace;
private _designerModel: Workspace;
private _isDragInProcess: boolean;
private _eventDispatcher: EventBusDispatcher;
private _listeners;
private _mouseMoveListener;
private _mouseUpListener;
constructor(workspace: Workspace, eventDispatcher: EventBusDispatcher) {
this._workspace = workspace; this._workspace = workspace;
this._designerModel = workspace; this._designerModel = workspace;
this._listeners = {}; this._listeners = {};
@ -34,7 +50,7 @@ class DragManager {
const screen = workspace.getScreenManager(); const screen = workspace.getScreenManager();
const dragManager = this; const dragManager = this;
const me = this; const me = this;
const mouseDownListener = function mouseDownListener(event) { const mouseDownListener = function mouseDownListener() {
if (workspace.isWorkspaceEventsEnabled()) { if (workspace.isWorkspaceEventsEnabled()) {
// Disable double drag... // Disable double drag...
workspace.enableWorkspaceEvents(false); workspace.enableWorkspaceEvents(false);
@ -62,11 +78,11 @@ class DragManager {
node.addEvent('mousedown', mouseDownListener); node.addEvent('mousedown', mouseDownListener);
} }
remove(node) { remove() {
throw new Error('Not implemented: DragManager.prototype.remove'); throw new Error('Not implemented: DragManager.prototype.remove');
} }
_buildMouseMoveListener(workspace, dragNode, dragManager) { protected _buildMouseMoveListener(workspace: Workspace, dragNode, dragManager: DragManager) {
const screen = workspace.getScreenManager(); const screen = workspace.getScreenManager();
const me = this; const me = this;
const result = (event) => { const result = (event) => {
@ -98,7 +114,7 @@ class DragManager {
return result; return result;
} }
_buildMouseUpListener(workspace, node, dragNode, dragManager) { protected _buildMouseUpListener(workspace: Workspace, node, dragNode, dragManager: DragManager) {
const screen = workspace.getScreenManager(); const screen = workspace.getScreenManager();
const me = this; const me = this;
const result = (event) => { const result = (event) => {

View File

@ -258,7 +258,7 @@ class Relationship extends ConnectionLine {
} }
// @typescript-eslint/ban-types // @typescript-eslint/ban-types
addEvent(eventType: string, listener: any) { addEvent(eventType: string, listener) {
let type = eventType; let type = eventType;
// Translate to web 2d events ... // Translate to web 2d events ...
if (type === 'onfocus') { if (type === 'onfocus') {

View File

@ -17,6 +17,7 @@
*/ */
import { $assert } from '@wisemapping/core-js'; import { $assert } from '@wisemapping/core-js';
import { Point } from '@wisemapping/web2d'; import { Point } from '@wisemapping/web2d';
import Icon from './Icon';
import Topic from './Topic'; import Topic from './Topic';
class ScreenManager { class ScreenManager {
@ -75,7 +76,7 @@ class ScreenManager {
fireEvent(type: string, event: UIEvent = null) { fireEvent(type: string, event: UIEvent = null) {
if (type === 'click') { if (type === 'click') {
this._clickEvents.forEach((listener: (arg0: any, arg1: any) => void) => { this._clickEvents.forEach((listener) => {
listener(type, event); listener(type, event);
}); });
} else { } else {
@ -101,7 +102,7 @@ class ScreenManager {
return { x, y }; return { x, y };
} }
getWorkspaceIconPosition(e: { getImage: () => any; getSize: () => any; getGroup: () => any; }) { getWorkspaceIconPosition(e: Icon) {
// Retrieve current icon position. // Retrieve current icon position.
const image = e.getImage(); const image = e.getImage();
const elementPosition = image.getPosition(); const elementPosition = image.getPosition();

View File

@ -24,7 +24,7 @@ import Topic from '../Topic';
class DragTopicCommand extends Command { class DragTopicCommand extends Command {
private _topicsId: number; private _topicsId: number;
private _parentId: any; private _parentId: number;
private _position: Point; private _position: Point;
@ -62,7 +62,7 @@ class DragTopicCommand extends Command {
const origPosition = topic.getPosition(); const origPosition = topic.getPosition();
// Disconnect topic .. // Disconnect topic ..
if ($defined(origParentTopic) && origParentTopic !== this._parentId) { if ($defined(origParentTopic) && origParentTopic.getId() !== this._parentId) {
commandContext.disconnect(topic); commandContext.disconnect(topic);
} }
@ -76,9 +76,9 @@ class DragTopicCommand extends Command {
} }
// Finally, connect topic ... // Finally, connect topic ...
if (origParentTopic !== this._parentId) { if (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);
} }

View File

@ -18,13 +18,14 @@
import { $assert, $defined } from '@wisemapping/core-js'; import { $assert, $defined } from '@wisemapping/core-js';
import Command from '../Command'; import Command from '../Command';
import CommandContext from '../CommandContext'; import CommandContext from '../CommandContext';
import FeatureModel from '../model/FeatureModel';
class RemoveFeatureFromTopicCommand extends Command { class RemoveFeatureFromTopicCommand extends Command {
private _topicId: number; private _topicId: number;
private _featureId: number; private _featureId: number;
private _oldFeature: any; private _oldFeature: FeatureModel;
/** /**
* @classdesc This command handles do/undo of removing a feature from a topic, e.g. an icon or * @classdesc This command handles do/undo of removing a feature from a topic, e.g. an icon or