diff --git a/packages/mindplot/src/components/NodeGraph.ts b/packages/mindplot/src/components/NodeGraph.ts index 75b29cd5..745d77bf 100644 --- a/packages/mindplot/src/components/NodeGraph.ts +++ b/packages/mindplot/src/components/NodeGraph.ts @@ -105,7 +105,7 @@ abstract class NodeGraph { return this._size; } - setSize(size: SizeType, force?: boolean) { + setSize(size: SizeType) { this._size.width = size.width; this._size.height = size.height; } diff --git a/packages/mindplot/src/components/Relationship.ts b/packages/mindplot/src/components/Relationship.ts index 3e056911..a3abb457 100644 --- a/packages/mindplot/src/components/Relationship.ts +++ b/packages/mindplot/src/components/Relationship.ts @@ -349,7 +349,7 @@ class Relationship extends ConnectionLine { return this._model.getId(); } - fireEvent(type: string, event: any): void { + fireEvent(type: string, event): void { const elem = this._line2d; elem.trigger(type, event); } diff --git a/packages/mindplot/src/components/commands/DeleteCommand.ts b/packages/mindplot/src/components/commands/DeleteCommand.ts index 26b995ec..e28b002b 100644 --- a/packages/mindplot/src/components/commands/DeleteCommand.ts +++ b/packages/mindplot/src/components/commands/DeleteCommand.ts @@ -18,17 +18,20 @@ import { $assert, $defined } from '@wisemapping/core-js'; import Command from '../Command'; import CommandContext from '../CommandContext'; +import NodeModel from '../model/NodeModel'; +import RelationshipModel from '../model/RelationshipModel'; +import Topic from '../Topic'; class DeleteCommand extends Command { private _relIds: number[]; private _topicIds: number[]; - private _deletedTopicModels: any[]; + private _deletedTopicModels: NodeModel[]; - private _deletedRelModel: any[]; + private _deletedRelModel: RelationshipModel[]; - private _parentTopicIds: any[]; + private _parentTopicIds: number[]; constructor(topicIds: number[], relIds: number[]) { $assert($defined(relIds), 'topicIds can not be null'); @@ -101,11 +104,11 @@ class DeleteCommand extends Command { // Do they need to be connected ? this._deletedTopicModels.forEach(((topicModel, index) => { - const topics = commandContext.findTopics(topicModel.getId()); + const topics = commandContext.findTopics([topicModel.getId()]); const parentId = this._parentTopicIds[index]; if (parentId) { - const parentTopics = commandContext.findTopics(parentId); + const parentTopics = commandContext.findTopics([parentId]); commandContext.connect(topics[0], parentTopics[0]); } })); @@ -117,14 +120,14 @@ class DeleteCommand extends Command { // Finally display the topics ... this._deletedTopicModels.forEach((topicModel) => { - const topics = commandContext.findTopics(topicModel.getId()); + const topics = commandContext.findTopics([topicModel.getId()]); topics[0].setBranchVisibility(true); }); // Focus on last recovered topic .. if (this._deletedTopicModels.length > 0) { const firstTopic = this._deletedTopicModels[0]; - const topic = commandContext.findTopics(firstTopic.getId())[0]; + const topic = commandContext.findTopics([firstTopic.getId()])[0]; topic.setOnFocus(true); } @@ -133,11 +136,11 @@ class DeleteCommand extends Command { this._deletedRelModel = []; } - _filterChildren(topicIds, commandContext) { + private _filterChildren(topicIds: number[], commandContext: CommandContext) { const topics = commandContext.findTopics(topicIds); const result = []; - topics.forEach((topic) => { + topics.forEach((topic: Topic) => { let parent = topic.getParent(); let found = false; while (parent != null && !found) { @@ -156,7 +159,7 @@ class DeleteCommand extends Command { return result; } - _collectInDepthRelationships(topic) { + _collectInDepthRelationships(topic: Topic) { let result = []; result = result.concat(topic.getRelationships()); diff --git a/packages/mindplot/src/components/commands/GenericFunctionCommand.ts b/packages/mindplot/src/components/commands/GenericFunctionCommand.ts index 9054a2ce..b7887967 100644 --- a/packages/mindplot/src/components/commands/GenericFunctionCommand.ts +++ b/packages/mindplot/src/components/commands/GenericFunctionCommand.ts @@ -20,18 +20,20 @@ import Command from '../Command'; import CommandContext from '../CommandContext'; import Topic from '../Topic'; +type CommandTypes = string | object | boolean | number; + class GenericFunctionCommand extends Command { - private _value: string | object | boolean | number; + private _value: CommandTypes; private _topicsId: number[]; - private _commandFunc: (topic: Topic, value: string | object | boolean | number) => string | object | boolean; + private _commandFunc: (topic: Topic, value: CommandTypes) => CommandTypes; - private _oldValues: any[]; + private _oldValues: (CommandTypes)[]; private _applied: boolean; - constructor(commandFunc: (topic: Topic, value: string | object | boolean) => string | object | boolean, topicsIds: number[], value: string | object | boolean | number = undefined) { + constructor(commandFunc: (topic: Topic, value: CommandTypes) => CommandTypes, topicsIds: number[], value: CommandTypes = undefined) { $assert(commandFunc, 'commandFunc must be defined'); $assert($defined(topicsIds), 'topicsIds must be defined'); diff --git a/packages/mindplot/src/components/export/BinaryImageExporter.ts b/packages/mindplot/src/components/export/BinaryImageExporter.ts index 34a69cb8..bee35ab2 100644 --- a/packages/mindplot/src/components/export/BinaryImageExporter.ts +++ b/packages/mindplot/src/components/export/BinaryImageExporter.ts @@ -57,7 +57,7 @@ class BinaryImageExporter extends Exporter { // Render the image and wait for the response ... const img = new Image(); - const result = new Promise((resolve, reject) => { + const result = new Promise((resolve) => { img.onload = () => { const ctx = canvas.getContext('2d'); // Scale for retina ... diff --git a/packages/mindplot/src/components/layout/RootedTreeSet.ts b/packages/mindplot/src/components/layout/RootedTreeSet.ts index e396e2bb..bc803331 100644 --- a/packages/mindplot/src/components/layout/RootedTreeSet.ts +++ b/packages/mindplot/src/components/layout/RootedTreeSet.ts @@ -24,7 +24,6 @@ class RootedTreeSet { protected _children: Node[]; - constructor() { this._rootNodes = []; } @@ -293,7 +292,7 @@ class RootedTreeSet { } } - _plot(canvas, node: Node, root?) { + _plot(canvas, node: Node) { const children = this.getChildren(node); const cx = node.getPosition().x + canvas.width / 2 - node.getSize().width / 2; const cy = node.getPosition().y + canvas.height / 2 - node.getSize().height / 2;