mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-12-22 19:53:49 +01:00
Fix eslint
This commit is contained in:
parent
b7406956a9
commit
1367321ea5
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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');
|
||||
|
||||
|
@ -57,7 +57,7 @@ class BinaryImageExporter extends Exporter {
|
||||
|
||||
// Render the image and wait for the response ...
|
||||
const img = new Image();
|
||||
const result = new Promise<string>((resolve, reject) => {
|
||||
const result = new Promise<string>((resolve) => {
|
||||
img.onload = () => {
|
||||
const ctx = canvas.getContext('2d');
|
||||
// Scale for retina ...
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user