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 DragTopic from './DragTopic';
import EventBusDispatcher from './layout/EventBusDispatcher';
import Workspace from './Workspace';
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._designerModel = workspace;
this._listeners = {};
@ -34,7 +50,7 @@ class DragManager {
const screen = workspace.getScreenManager();
const dragManager = this;
const me = this;
const mouseDownListener = function mouseDownListener(event) {
const mouseDownListener = function mouseDownListener() {
if (workspace.isWorkspaceEventsEnabled()) {
// Disable double drag...
workspace.enableWorkspaceEvents(false);
@ -62,11 +78,11 @@ class DragManager {
node.addEvent('mousedown', mouseDownListener);
}
remove(node) {
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 me = this;
const result = (event) => {
@ -98,7 +114,7 @@ class DragManager {
return result;
}
_buildMouseUpListener(workspace, node, dragNode, dragManager) {
protected _buildMouseUpListener(workspace: Workspace, node, dragNode, dragManager: DragManager) {
const screen = workspace.getScreenManager();
const me = this;
const result = (event) => {

View File

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

View File

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

View File

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

View File

@ -18,13 +18,14 @@
import { $assert, $defined } from '@wisemapping/core-js';
import Command from '../Command';
import CommandContext from '../CommandContext';
import FeatureModel from '../model/FeatureModel';
class RemoveFeatureFromTopicCommand extends Command {
private _topicId: 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
@ -43,7 +44,7 @@ class RemoveFeatureFromTopicCommand extends Command {
/**
* Overrides abstract parent method
*/
execute(commandContext:CommandContext):void {
execute(commandContext: CommandContext): void {
const topic = commandContext.findTopics([this._topicId])[0];
const feature = topic.findFeatureById(this._featureId);
topic.removeFeature(feature);
@ -54,7 +55,7 @@ class RemoveFeatureFromTopicCommand extends Command {
* Overrides abstract parent method
* @see {@link mindplot.Command.undoExecute}
*/
undoExecute(commandContext:CommandContext) {
undoExecute(commandContext: CommandContext) {
const topic = commandContext.findTopics([this._topicId])[0];
topic.addFeature(this._oldFeature);
this._oldFeature = null;