mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-22 14:47:56 +01:00
Fix error on change color.
This commit is contained in:
parent
44c0a9ee9c
commit
12835ded0a
@ -779,8 +779,6 @@ class Designer extends Events {
|
|||||||
}
|
}
|
||||||
|
|
||||||
changeFontColor(color: string | undefined): void {
|
changeFontColor(color: string | undefined): void {
|
||||||
$assert(color, 'color can not be null');
|
|
||||||
|
|
||||||
const topicsIds = this.getModel().filterTopicsIds();
|
const topicsIds = this.getModel().filterTopicsIds();
|
||||||
|
|
||||||
if (topicsIds.length > 0) {
|
if (topicsIds.length > 0) {
|
||||||
@ -788,7 +786,6 @@ class Designer extends Events {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
|
||||||
changeBackgroundColor(color: string | undefined): void {
|
changeBackgroundColor(color: string | undefined): void {
|
||||||
const validateFunc = (topic: Topic) => topic.getShapeType() !== 'line';
|
const validateFunc = (topic: Topic) => topic.getShapeType() !== 'line';
|
||||||
const validateError = 'Color can not be set to line topics.';
|
const validateError = 'Color can not be set to line topics.';
|
||||||
|
@ -476,7 +476,7 @@ abstract class Topic extends NodeGraph {
|
|||||||
this.redraw();
|
this.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
setText(text: string | undefined) {
|
setText(text: string | undefined): void {
|
||||||
// Avoid empty nodes ...
|
// Avoid empty nodes ...
|
||||||
const modelText = !text || text.trim().length === 0 ? undefined : text;
|
const modelText = !text || text.trim().length === 0 ? undefined : text;
|
||||||
|
|
||||||
@ -1250,8 +1250,10 @@ abstract class Topic extends NodeGraph {
|
|||||||
} else {
|
} else {
|
||||||
// In case of images, the size is fixed ...
|
// In case of images, the size is fixed ...
|
||||||
const size = this.getModel().getImageSize();
|
const size = this.getModel().getImageSize();
|
||||||
|
if (size) {
|
||||||
this.setSize(size, false);
|
this.setSize(size, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (redrawChildren) {
|
if (redrawChildren) {
|
||||||
this.getChildren().forEach((t) => t.redraw(redrawChildren));
|
this.getChildren().forEach((t) => t.redraw(redrawChildren));
|
||||||
|
@ -23,6 +23,7 @@ import { FontWeightType } from '../FontWeightType';
|
|||||||
import { FontStyleType } from '../FontStyleType';
|
import { FontStyleType } from '../FontStyleType';
|
||||||
import FeatureModel from './FeatureModel';
|
import FeatureModel from './FeatureModel';
|
||||||
import Mindmap from './Mindmap';
|
import Mindmap from './Mindmap';
|
||||||
|
import SizeType from '../SizeType';
|
||||||
|
|
||||||
export type NodeModelType = 'CentralTopic' | 'MainTopic';
|
export type NodeModelType = 'CentralTopic' | 'MainTopic';
|
||||||
|
|
||||||
@ -93,14 +94,14 @@ abstract class INodeModel {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
setImageSize(width: number, height: number) {
|
setImageSize(width: number, height: number): void {
|
||||||
this.putProperty('imageSize', `{width:${width},height:${height}}`);
|
this.putProperty('imageSize', `{width:${width},height:${height}}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
getImageSize(): { width: number; height: number } {
|
getImageSize(): SizeType | undefined {
|
||||||
const value = this.getProperty('imageSize') as string;
|
const value = this.getProperty('imageSize') as string;
|
||||||
let result;
|
let result: SizeType | undefined;
|
||||||
if (value != null) {
|
if (value) {
|
||||||
result = parseJsObject(value);
|
result = parseJsObject(value);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -143,7 +144,7 @@ abstract class INodeModel {
|
|||||||
this.putProperty('shapeType', type);
|
this.putProperty('shapeType', type);
|
||||||
}
|
}
|
||||||
|
|
||||||
setOrder(value: number) {
|
setOrder(value: number): void {
|
||||||
$assert(
|
$assert(
|
||||||
(typeof value === 'number' && Number.isFinite(value)) || value == null,
|
(typeof value === 'number' && Number.isFinite(value)) || value == null,
|
||||||
'Order must be null or a number',
|
'Order must be null or a number',
|
||||||
@ -163,7 +164,7 @@ abstract class INodeModel {
|
|||||||
return this.getProperty('fontFamily') as string;
|
return this.getProperty('fontFamily') as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
setFontStyle(fontStyle: FontStyleType) {
|
setFontStyle(fontStyle: FontStyleType | undefined) {
|
||||||
this.putProperty('fontStyle', fontStyle);
|
this.putProperty('fontStyle', fontStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -336,9 +337,8 @@ abstract class INodeModel {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
findNodeById(id: number): INodeModel {
|
findNodeById(id: number): INodeModel | undefined {
|
||||||
$assert(Number.isFinite(id));
|
let result: INodeModel | undefined;
|
||||||
let result;
|
|
||||||
if (this.getId() === id) {
|
if (this.getId() === id) {
|
||||||
result = this;
|
result = this;
|
||||||
} else {
|
} else {
|
||||||
|
@ -98,9 +98,8 @@ class XMLSerializerTango implements XMLMindmapSerializer {
|
|||||||
const shape = topic.getShapeType();
|
const shape = topic.getShapeType();
|
||||||
if ($defined(shape)) {
|
if ($defined(shape)) {
|
||||||
parentTopic.setAttribute('shape', shape);
|
parentTopic.setAttribute('shape', shape);
|
||||||
|
|
||||||
if (shape === 'image') {
|
|
||||||
const size = topic.getImageSize();
|
const size = topic.getImageSize();
|
||||||
|
if (shape === 'image' && size) {
|
||||||
parentTopic.setAttribute('image', `${size.width},${size.height}:${topic.getImageUrl()}`);
|
parentTopic.setAttribute('image', `${size.width},${size.height}:${topic.getImageUrl()}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,11 +29,13 @@ class ImageTopicShape extends Image {
|
|||||||
const size = model.getImageSize();
|
const size = model.getImageSize();
|
||||||
|
|
||||||
super.setHref(url);
|
super.setHref(url);
|
||||||
|
if (size) {
|
||||||
super.setSize(size.width, size.height);
|
super.setSize(size.width, size.height);
|
||||||
|
}
|
||||||
this._topic = topic;
|
this._topic = topic;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSize(): SizeType {
|
getSize(): SizeType | undefined {
|
||||||
return this._topic.getModel().getImageSize();
|
return this._topic.getModel().getImageSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
const path = require('path');
|
|
||||||
|
|
||||||
/** @type {import('webpack').Configuration} */
|
/** @type {import('webpack').Configuration} */
|
||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: [new CleanWebpackPlugin()],
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user