mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 14:47:56 +01:00
Clean up code.
This commit is contained in:
parent
fe8af2f7a5
commit
0a707d2860
@ -152,7 +152,7 @@ class StandaloneActionDispatcher extends ActionDispatcher {
|
|||||||
|
|
||||||
const commandFunc = (topic: Topic, commandColor: string) => {
|
const commandFunc = (topic: Topic, commandColor: string) => {
|
||||||
const result = topic.getFontColor();
|
const result = topic.getFontColor();
|
||||||
topic.setFontColor(commandColor, true);
|
topic.setFontColor(commandColor);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -211,14 +211,6 @@ abstract class Topic extends NodeGraph {
|
|||||||
// Create inner box.
|
// Create inner box.
|
||||||
this._innerShape = this._buildShape(TopicConfig.INNER_RECT_ATTRIBUTES, this.getShapeType());
|
this._innerShape = this._buildShape(TopicConfig.INNER_RECT_ATTRIBUTES, this.getShapeType());
|
||||||
|
|
||||||
// Update bgcolor ...
|
|
||||||
const bgColor = this.getBackgroundColor();
|
|
||||||
this._setBackgroundColor(bgColor, false);
|
|
||||||
|
|
||||||
// Update border color ...
|
|
||||||
const brColor = this.getBorderColor();
|
|
||||||
this._setBorderColor(brColor, false);
|
|
||||||
|
|
||||||
// Define the pointer ...
|
// Define the pointer ...
|
||||||
if (!this.isCentralTopic() && !this.isReadOnly()) {
|
if (!this.isCentralTopic() && !this.isReadOnly()) {
|
||||||
this._innerShape.setCursor('move');
|
this._innerShape.setCursor('move');
|
||||||
@ -494,13 +486,11 @@ abstract class Topic extends NodeGraph {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
setFontColor(value: string, updateModel?: boolean) {
|
setFontColor(value: string) {
|
||||||
const textShape = this.getTextShape();
|
const model = this.getModel();
|
||||||
textShape.setColor(value);
|
model.setFontColor(value);
|
||||||
if (updateModel) {
|
|
||||||
const model = this.getModel();
|
this.redraw();
|
||||||
model.setFontColor(value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private _setText(text: string | null, updateModel?: boolean) {
|
private _setText(text: string | null, updateModel?: boolean) {
|
||||||
@ -531,32 +521,26 @@ abstract class Topic extends NodeGraph {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setBackgroundColor(color: string | undefined): void {
|
setBackgroundColor(color: string | undefined): void {
|
||||||
this._setBackgroundColor(color, true);
|
const model = this.getModel();
|
||||||
|
model.setBackgroundColor(color);
|
||||||
|
|
||||||
this.redraw();
|
this.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
setConnectionStyle(type: LineType): void {
|
setConnectionStyle(type: LineType): void {
|
||||||
const model = this.getModel();
|
const model = this.getModel();
|
||||||
model.setConnectionStyle(type);
|
model.setConnectionStyle(type);
|
||||||
|
|
||||||
this.redraw(true);
|
this.redraw(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
setConnectionColor(value: string | undefined): void {
|
setConnectionColor(value: string | undefined): void {
|
||||||
const model = this.getModel();
|
const model = this.getModel();
|
||||||
model.setConnectionColor(value);
|
model.setConnectionColor(value);
|
||||||
|
|
||||||
this.redraw(true);
|
this.redraw(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _setBackgroundColor(color: string | undefined, updateModel: boolean) {
|
|
||||||
const innerShape = this.getInnerShape();
|
|
||||||
innerShape.setFill(color);
|
|
||||||
|
|
||||||
if (updateModel) {
|
|
||||||
const model = this.getModel();
|
|
||||||
model.setBackgroundColor(color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getBackgroundColor(): string {
|
getBackgroundColor(): string {
|
||||||
const model = this.getModel();
|
const model = this.getModel();
|
||||||
let result = model.getBackgroundColor();
|
let result = model.getBackgroundColor();
|
||||||
@ -573,26 +557,12 @@ abstract class Topic extends NodeGraph {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setBorderColor(color: string | undefined): void {
|
setBorderColor(color: string | undefined): void {
|
||||||
this._setBorderColor(color, true);
|
const model = this.getModel();
|
||||||
|
model.setBorderColor(color);
|
||||||
|
|
||||||
this.redraw(true);
|
this.redraw(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _setBorderColor(color: string | undefined, updateModel: boolean): void {
|
|
||||||
if (updateModel) {
|
|
||||||
const model = this.getModel();
|
|
||||||
model.setBorderColor(color);
|
|
||||||
}
|
|
||||||
|
|
||||||
const bgColor = this.getBackgroundColor();
|
|
||||||
const connector = this.getShrinkConnector();
|
|
||||||
if (connector) {
|
|
||||||
connector.setColor(bgColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
const innerShape = this.getInnerShape();
|
|
||||||
innerShape.setAttribute('strokeColor', color);
|
|
||||||
}
|
|
||||||
|
|
||||||
getBorderColor(): string {
|
getBorderColor(): string {
|
||||||
const model = this.getModel();
|
const model = this.getModel();
|
||||||
let result = model.getBorderColor();
|
let result = model.getBorderColor();
|
||||||
@ -1312,6 +1282,10 @@ abstract class Topic extends NodeGraph {
|
|||||||
const bgColor = this.getBackgroundColor();
|
const bgColor = this.getBackgroundColor();
|
||||||
this.getInnerShape().setFill(bgColor);
|
this.getInnerShape().setFill(bgColor);
|
||||||
|
|
||||||
|
// Update font ...
|
||||||
|
const fontColor = this.getFontColor();
|
||||||
|
textShape.setColor(fontColor);
|
||||||
|
|
||||||
// Force the repaint in case that the main topic color has changed.
|
// Force the repaint in case that the main topic color has changed.
|
||||||
if (this.getParent()) {
|
if (this.getParent()) {
|
||||||
this._connector.setColor(borderColor);
|
this._connector.setColor(borderColor);
|
||||||
|
Loading…
Reference in New Issue
Block a user