83 lines
3.0 KiB
TypeScript
Raw Normal View History

2022-01-24 22:09:30 -08:00
/* eslint-disable import/no-cycle */
/* eslint-disable no-use-before-define */
/*
* Copyright [2021] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { $assert } from '@wisemapping/core-js';
import Point from '@wisemapping/web2d';
import { Mindmap } from '..';
import CommandContext from './CommandContext';
import Events from './Events';
import NodeModel from './model/NodeModel';
import RelationshipModel from './model/RelationshipModel';
import Topic from './Topic';
abstract class ActionDispatcher extends Events {
2022-01-31 00:05:22 +00:00
private static _instance: ActionDispatcher;
2022-01-24 22:09:30 -08:00
constructor(commandContext: CommandContext) {
$assert(commandContext, 'commandContext can not be null');
super();
}
2022-01-31 00:05:22 +00:00
abstract addRelationship(model: RelationshipModel, mindmap: Mindmap): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
abstract addTopics(models: NodeModel[], parentTopicId: number[]): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
abstract deleteEntities(topicsIds: number[], relIds: number[]): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
abstract dragTopic(topicId: number, position: Point, order: number, parentTopic: Topic): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
abstract moveTopic(topicId: number, position: Point): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
abstract moveControlPoint(ctrlPoint: this, point: Point): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
abstract changeFontFamilyToTopic(topicIds: number[], fontFamily: string): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
abstract changeFontStyleToTopic(topicsIds: number[]): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
abstract changeFontColorToTopic(topicsIds: number[], color: string): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
abstract changeFontSizeToTopic(topicsIds: number[], size: number): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
abstract changeBackgroundColorToTopic(topicsIds: number[], color: string): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
abstract changeBorderColorToTopic(topicsIds: number[], color: string): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
abstract changeShapeTypeToTopic(topicsIds: number[], shapeType: string): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
abstract changeFontWeightToTopic(topicsIds: number[]): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
abstract changeTextToTopic(topicsIds: number[], text: string): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
abstract shrinkBranch(topicsIds: number[], collapse: boolean): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
abstract addFeatureToTopic(topicId: number, type: string, attributes: object): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
abstract changeFeatureToTopic(topicId: number, featureId: number, attributes: object): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
abstract removeFeatureFromTopic(topicId: number, featureId: number): void;
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
static setInstance = (dispatcher: ActionDispatcher) => {
this._instance = dispatcher;
};
2022-01-24 22:09:30 -08:00
2022-01-31 00:05:22 +00:00
static getInstance = (): ActionDispatcher => ActionDispatcher._instance;
2022-01-24 22:09:30 -08:00
}
export default ActionDispatcher;