mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 14:47:56 +01:00
Fix eslint
This commit is contained in:
parent
b7406956a9
commit
1367321ea5
@ -105,7 +105,7 @@ abstract class NodeGraph {
|
|||||||
return this._size;
|
return this._size;
|
||||||
}
|
}
|
||||||
|
|
||||||
setSize(size: SizeType, force?: boolean) {
|
setSize(size: SizeType) {
|
||||||
this._size.width = size.width;
|
this._size.width = size.width;
|
||||||
this._size.height = size.height;
|
this._size.height = size.height;
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ class Relationship extends ConnectionLine {
|
|||||||
return this._model.getId();
|
return this._model.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
fireEvent(type: string, event: any): void {
|
fireEvent(type: string, event): void {
|
||||||
const elem = this._line2d;
|
const elem = this._line2d;
|
||||||
elem.trigger(type, event);
|
elem.trigger(type, event);
|
||||||
}
|
}
|
||||||
|
@ -18,17 +18,20 @@
|
|||||||
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 NodeModel from '../model/NodeModel';
|
||||||
|
import RelationshipModel from '../model/RelationshipModel';
|
||||||
|
import Topic from '../Topic';
|
||||||
|
|
||||||
class DeleteCommand extends Command {
|
class DeleteCommand extends Command {
|
||||||
private _relIds: number[];
|
private _relIds: number[];
|
||||||
|
|
||||||
private _topicIds: 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[]) {
|
constructor(topicIds: number[], relIds: number[]) {
|
||||||
$assert($defined(relIds), 'topicIds can not be null');
|
$assert($defined(relIds), 'topicIds can not be null');
|
||||||
@ -101,11 +104,11 @@ class DeleteCommand extends Command {
|
|||||||
|
|
||||||
// Do they need to be connected ?
|
// Do they need to be connected ?
|
||||||
this._deletedTopicModels.forEach(((topicModel, index) => {
|
this._deletedTopicModels.forEach(((topicModel, index) => {
|
||||||
const topics = commandContext.findTopics(topicModel.getId());
|
const topics = commandContext.findTopics([topicModel.getId()]);
|
||||||
|
|
||||||
const parentId = this._parentTopicIds[index];
|
const parentId = this._parentTopicIds[index];
|
||||||
if (parentId) {
|
if (parentId) {
|
||||||
const parentTopics = commandContext.findTopics(parentId);
|
const parentTopics = commandContext.findTopics([parentId]);
|
||||||
commandContext.connect(topics[0], parentTopics[0]);
|
commandContext.connect(topics[0], parentTopics[0]);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
@ -117,14 +120,14 @@ class DeleteCommand extends Command {
|
|||||||
|
|
||||||
// Finally display the topics ...
|
// Finally display the topics ...
|
||||||
this._deletedTopicModels.forEach((topicModel) => {
|
this._deletedTopicModels.forEach((topicModel) => {
|
||||||
const topics = commandContext.findTopics(topicModel.getId());
|
const topics = commandContext.findTopics([topicModel.getId()]);
|
||||||
topics[0].setBranchVisibility(true);
|
topics[0].setBranchVisibility(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Focus on last recovered topic ..
|
// Focus on last recovered topic ..
|
||||||
if (this._deletedTopicModels.length > 0) {
|
if (this._deletedTopicModels.length > 0) {
|
||||||
const firstTopic = this._deletedTopicModels[0];
|
const firstTopic = this._deletedTopicModels[0];
|
||||||
const topic = commandContext.findTopics(firstTopic.getId())[0];
|
const topic = commandContext.findTopics([firstTopic.getId()])[0];
|
||||||
topic.setOnFocus(true);
|
topic.setOnFocus(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,11 +136,11 @@ class DeleteCommand extends Command {
|
|||||||
this._deletedRelModel = [];
|
this._deletedRelModel = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
_filterChildren(topicIds, commandContext) {
|
private _filterChildren(topicIds: number[], commandContext: CommandContext) {
|
||||||
const topics = commandContext.findTopics(topicIds);
|
const topics = commandContext.findTopics(topicIds);
|
||||||
|
|
||||||
const result = [];
|
const result = [];
|
||||||
topics.forEach((topic) => {
|
topics.forEach((topic: Topic) => {
|
||||||
let parent = topic.getParent();
|
let parent = topic.getParent();
|
||||||
let found = false;
|
let found = false;
|
||||||
while (parent != null && !found) {
|
while (parent != null && !found) {
|
||||||
@ -156,7 +159,7 @@ class DeleteCommand extends Command {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
_collectInDepthRelationships(topic) {
|
_collectInDepthRelationships(topic: Topic) {
|
||||||
let result = [];
|
let result = [];
|
||||||
result = result.concat(topic.getRelationships());
|
result = result.concat(topic.getRelationships());
|
||||||
|
|
||||||
|
@ -20,18 +20,20 @@ import Command from '../Command';
|
|||||||
import CommandContext from '../CommandContext';
|
import CommandContext from '../CommandContext';
|
||||||
import Topic from '../Topic';
|
import Topic from '../Topic';
|
||||||
|
|
||||||
|
type CommandTypes = string | object | boolean | number;
|
||||||
|
|
||||||
class GenericFunctionCommand extends Command {
|
class GenericFunctionCommand extends Command {
|
||||||
private _value: string | object | boolean | number;
|
private _value: CommandTypes;
|
||||||
|
|
||||||
private _topicsId: number[];
|
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;
|
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(commandFunc, 'commandFunc must be defined');
|
||||||
$assert($defined(topicsIds), 'topicsIds 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 ...
|
// Render the image and wait for the response ...
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
const result = new Promise<string>((resolve, reject) => {
|
const result = new Promise<string>((resolve) => {
|
||||||
img.onload = () => {
|
img.onload = () => {
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
// Scale for retina ...
|
// Scale for retina ...
|
||||||
|
@ -24,7 +24,6 @@ class RootedTreeSet {
|
|||||||
|
|
||||||
protected _children: Node[];
|
protected _children: Node[];
|
||||||
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this._rootNodes = [];
|
this._rootNodes = [];
|
||||||
}
|
}
|
||||||
@ -293,7 +292,7 @@ class RootedTreeSet {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_plot(canvas, node: Node, root?) {
|
_plot(canvas, node: Node) {
|
||||||
const children = this.getChildren(node);
|
const children = this.getChildren(node);
|
||||||
const cx = node.getPosition().x + canvas.width / 2 - node.getSize().width / 2;
|
const cx = node.getPosition().x + canvas.width / 2 - node.getSize().width / 2;
|
||||||
const cy = node.getPosition().y + canvas.height / 2 - node.getSize().height / 2;
|
const cy = node.getPosition().y + canvas.height / 2 - node.getSize().height / 2;
|
||||||
|
Loading…
Reference in New Issue
Block a user