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