mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-13 02:37:57 +01:00
Add missing types to commands.
This commit is contained in:
parent
e83cd3e9fa
commit
5dc6fb37d7
@ -375,17 +375,14 @@ abstract class Topic extends NodeGraph {
|
||||
this.adjustShapes();
|
||||
}
|
||||
|
||||
/** */
|
||||
addRelationship(relationship: Relationship) {
|
||||
this._relationships.push(relationship);
|
||||
}
|
||||
|
||||
/** */
|
||||
deleteRelationship(relationship: Rect) {
|
||||
this._relationships = this._relationships.filter((r) => r !== relationship);
|
||||
}
|
||||
|
||||
/** */
|
||||
getRelationships(): Relationship[] {
|
||||
return this._relationships;
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
import { $assert } from '@wisemapping/core-js';
|
||||
import Command from '../Command';
|
||||
import CommandContext from '../CommandContext';
|
||||
import RelationshipModel from '../model/RelationshipModel';
|
||||
|
||||
class AddRelationshipCommand extends Command {
|
||||
@ -25,27 +26,20 @@ class AddRelationshipCommand extends Command {
|
||||
/**
|
||||
* @classdesc This command class handles do/undo of adding a relationship to a topic.
|
||||
*/
|
||||
constructor(model:RelationshipModel) {
|
||||
constructor(model: RelationshipModel) {
|
||||
$assert(model, 'Relationship model can not be null');
|
||||
|
||||
super();
|
||||
this._model = model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides abstract parent method
|
||||
*/
|
||||
execute(commandContext) {
|
||||
execute(commandContext: CommandContext) {
|
||||
const relationship = commandContext.addRelationship(this._model);
|
||||
relationship.setOnFocus(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides abstract parent method
|
||||
* @see {@link mindplot.Command.undoExecute}
|
||||
*/
|
||||
undoExecute(commandContext) {
|
||||
const rel = commandContext.findRelationships(this._model.getId());
|
||||
undoExecute(commandContext: CommandContext) {
|
||||
const rel = commandContext.findRelationships([this._model.getId()]);
|
||||
commandContext.deleteRelationship(rel[0]);
|
||||
}
|
||||
}
|
||||
|
@ -38,9 +38,6 @@ class AddTopicCommand extends Command {
|
||||
this._parentsIds = parentTopicsId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides abstract parent method
|
||||
*/
|
||||
execute(commandContext: CommandContext) {
|
||||
const me = this;
|
||||
this._models.forEach((model, index) => {
|
||||
@ -68,10 +65,6 @@ class AddTopicCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides abstract parent method
|
||||
* @see {@link mindplot.Command.undoExecute}
|
||||
*/
|
||||
undoExecute(commandContext: CommandContext) {
|
||||
// Delete disconnected the nodes. Create a copy of the topics ...
|
||||
const clonedModel = [];
|
||||
|
@ -37,9 +37,6 @@ class ChangeFeatureToTopicCommand extends Command {
|
||||
this._attributes = attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides abstract parent method
|
||||
*/
|
||||
execute(commandContext: CommandContext) {
|
||||
const topic = commandContext.findTopics([this._topicId])[0];
|
||||
const feature = topic.findFeatureById(this._featureId);
|
||||
@ -49,10 +46,6 @@ class ChangeFeatureToTopicCommand extends Command {
|
||||
this._attributes = oldAttributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides abstract parent method
|
||||
* @see {@link mindplot.Command.undoExecute}
|
||||
*/
|
||||
undoExecute(commandContext: CommandContext) {
|
||||
this.execute(commandContext);
|
||||
}
|
||||
|
@ -47,9 +47,6 @@ class DragTopicCommand extends Command {
|
||||
this._order = order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides abstract parent method
|
||||
*/
|
||||
execute(commandContext: CommandContext): void {
|
||||
const topic = commandContext.findTopics([this._topicsId])[0];
|
||||
topic.setVisibility(false);
|
||||
|
@ -19,19 +19,20 @@ import { $assert, $defined } from '@wisemapping/core-js';
|
||||
import { Line } from '@wisemapping/web2d';
|
||||
import Command from '../Command';
|
||||
import ControlPoint from '../ControlPoint';
|
||||
import PositionType from '../PositionType';
|
||||
|
||||
class MoveControlPointCommand extends Command {
|
||||
private _ctrlPointControler: ControlPoint;
|
||||
|
||||
private _line: Line;
|
||||
|
||||
private _controlPoint: any;
|
||||
private _controlPoint: Line;
|
||||
|
||||
private _oldControlPoint: any;
|
||||
private _oldControlPoint: Line;
|
||||
|
||||
private _originalEndPoint: any;
|
||||
private _originalEndPoint: PositionType;
|
||||
|
||||
private _wasCustom: any;
|
||||
private _wasCustom: boolean;
|
||||
|
||||
private _endPoint: any;
|
||||
|
||||
@ -68,9 +69,6 @@ class MoveControlPointCommand extends Command {
|
||||
this._point = point;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides abstract parent method
|
||||
*/
|
||||
execute() {
|
||||
const model = this._line.getModel();
|
||||
switch (this._point) {
|
||||
@ -97,10 +95,6 @@ class MoveControlPointCommand extends Command {
|
||||
this._line.getLine().updateLine(this._point);
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides abstract parent method
|
||||
* @see {@link mindplot.Command.undoExecute}
|
||||
*/
|
||||
undoExecute() {
|
||||
const line = this._line;
|
||||
const model = line.getModel();
|
||||
|
Loading…
Reference in New Issue
Block a user