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();
|
|
||||||
textShape.setColor(value);
|
|
||||||
if (updateModel) {
|
|
||||||
const model = this.getModel();
|
const model = this.getModel();
|
||||||
model.setFontColor(value);
|
model.setFontColor(value);
|
||||||
}
|
|
||||||
|
this.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
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,24 +557,10 @@ abstract class Topic extends NodeGraph {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setBorderColor(color: string | undefined): void {
|
setBorderColor(color: string | undefined): void {
|
||||||
this._setBorderColor(color, true);
|
|
||||||
this.redraw(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private _setBorderColor(color: string | undefined, updateModel: boolean): void {
|
|
||||||
if (updateModel) {
|
|
||||||
const model = this.getModel();
|
const model = this.getModel();
|
||||||
model.setBorderColor(color);
|
model.setBorderColor(color);
|
||||||
}
|
|
||||||
|
|
||||||
const bgColor = this.getBackgroundColor();
|
this.redraw(true);
|
||||||
const connector = this.getShrinkConnector();
|
|
||||||
if (connector) {
|
|
||||||
connector.setColor(bgColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
const innerShape = this.getInnerShape();
|
|
||||||
innerShape.setAttribute('strokeColor', color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getBorderColor(): string {
|
getBorderColor(): string {
|
||||||
@ -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