From 0fe100222f50809d4157222739452178b0a092c4 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Fri, 18 Feb 2022 07:26:15 -0800 Subject: [PATCH] Add missing type information. --- .../src/components/DesignerKeyboard.ts | 3 +-- .../components/StandaloneActionDispatcher.ts | 2 +- packages/mindplot/src/components/Topic.ts | 18 +++++++++--------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/packages/mindplot/src/components/DesignerKeyboard.ts b/packages/mindplot/src/components/DesignerKeyboard.ts index db7f73c4..0d146ef8 100644 --- a/packages/mindplot/src/components/DesignerKeyboard.ts +++ b/packages/mindplot/src/components/DesignerKeyboard.ts @@ -280,7 +280,6 @@ class DesignerKeyboard extends Keyboard { const nodes = designer.getModel().filterSelectedTopics(); if (nodes.length > 0) { // If a modifier is press, the key selected must be ignored. - const pressKey = String.fromCharCode(keyCode); if (event.ctrlKey || event.altKey || event.metaKey) { return; } @@ -363,7 +362,7 @@ class DesignerKeyboard extends Keyboard { } } - private _goToChild(designer, node) { + private _goToChild(designer: Designer, node: Topic) { const children = node.getChildren(); if (children.length > 0) { let target = children[0]; diff --git a/packages/mindplot/src/components/StandaloneActionDispatcher.ts b/packages/mindplot/src/components/StandaloneActionDispatcher.ts index 8fe87598..6d8c8f2e 100644 --- a/packages/mindplot/src/components/StandaloneActionDispatcher.ts +++ b/packages/mindplot/src/components/StandaloneActionDispatcher.ts @@ -114,7 +114,7 @@ class StandaloneActionDispatcher extends ActionDispatcher { changeTextToTopic(topicsIds: number[], text: string) { $assert($defined(topicsIds), 'topicsIds can not be null'); - const commandFunc = (topic: Topic, value: object) => { + const commandFunc = (topic: Topic, value: string) => { const result = topic.getText(); topic.setText(value); return result; diff --git a/packages/mindplot/src/components/Topic.ts b/packages/mindplot/src/components/Topic.ts index 0f457fc9..b36351a8 100644 --- a/packages/mindplot/src/components/Topic.ts +++ b/packages/mindplot/src/components/Topic.ts @@ -530,7 +530,7 @@ abstract class Topic extends NodeGraph { } } - _setText(text, updateModel) { + _setText(text: string, updateModel: boolean) { const textShape = this.getTextShape(); textShape.setText(text == null ? TopicStyle.defaultText(this) : text); @@ -541,7 +541,7 @@ abstract class Topic extends NodeGraph { } /** */ - setText(text) { + setText(text: string) { // Avoid empty nodes ... if (!text || $.trim(text).length === 0) { this._setText(null, true); @@ -553,7 +553,7 @@ abstract class Topic extends NodeGraph { } /** */ - getText() { + getText(): string { const model = this.getModel(); let result = model.getText(); if (!$defined(result)) { @@ -563,11 +563,11 @@ abstract class Topic extends NodeGraph { } /** */ - setBackgroundColor(color) { + setBackgroundColor(color: string) { this._setBackgroundColor(color, true); } - _setBackgroundColor(color, updateModel) { + _setBackgroundColor(color: string, updateModel: boolean) { const innerShape = this.getInnerShape(); innerShape.setFill(color); @@ -583,7 +583,7 @@ abstract class Topic extends NodeGraph { } /** */ - getBackgroundColor() { + getBackgroundColor(): string { const model = this.getModel(); let result = model.getBackgroundColor(); if (!$defined(result)) { @@ -593,11 +593,11 @@ abstract class Topic extends NodeGraph { } /** */ - setBorderColor(color) { + setBorderColor(color: string) { this._setBorderColor(color, true); } - _setBorderColor(color, updateModel) { + _setBorderColor(color: string, updateModel: boolean) { const innerShape = this.getInnerShape(); innerShape.setAttribute('strokeColor', color); @@ -1349,7 +1349,7 @@ abstract class Topic extends NodeGraph { return result; } - isCentralTopic() { + isCentralTopic(): boolean { return this.getModel().getType() === 'CentralTopic'; } }