Fix compilation.

This commit is contained in:
Paulo Gustavo Veiga 2023-01-02 19:26:08 -08:00
parent cf9b935bb1
commit 45dad486d7

View File

@ -22,8 +22,6 @@ import { Rect, Line, Text, Group, ElementClass } from '@wisemapping/web2d';
import NodeGraph, { NodeOption } from './NodeGraph'; import NodeGraph, { NodeOption } from './NodeGraph';
import TopicConfig from './TopicConfig'; import TopicConfig from './TopicConfig';
import TopicStyle from './TopicStyle'; import TopicStyle from './TopicStyle';
import { FontWeightType } from './FontWeightType';
import { FontStyleType } from './FontStyleType';
import TopicFeatureFactory from './TopicFeature'; import TopicFeatureFactory from './TopicFeature';
import ConnectionLine, { LineType } from './ConnectionLine'; import ConnectionLine, { LineType } from './ConnectionLine';
import IconGroup from './IconGroup'; import IconGroup from './IconGroup';
@ -46,6 +44,8 @@ import LineTopicShape from './widget/LineTopicShape';
import ImageTopicShape from './widget/ImageTopicShape'; import ImageTopicShape from './widget/ImageTopicShape';
import ColorUtil from './render/ColorUtil'; import ColorUtil from './render/ColorUtil';
import Icon from './Icon'; import Icon from './Icon';
import { FontStyleType } from './FontStyleType';
import { FontWeightType } from './FontWeightType';
const ICON_SCALING_FACTOR = 1.3; const ICON_SCALING_FACTOR = 1.3;
@ -340,6 +340,7 @@ abstract class Topic extends NodeGraph {
return model.findFeatureById(id); return model.findFeatureById(id);
} }
/** */
removeFeature(featureModel: FeatureModel): void { removeFeature(featureModel: FeatureModel): void {
$assert(featureModel, 'featureModel could not be null'); $assert(featureModel, 'featureModel could not be null');
@ -349,10 +350,9 @@ abstract class Topic extends NodeGraph {
// Removing the icon from UI // Removing the icon from UI
const iconGroup = this.getIconGroup(); const iconGroup = this.getIconGroup();
if (iconGroup) { if ($defined(iconGroup)) {
iconGroup.removeIconByModel(featureModel); iconGroup.removeIconByModel(featureModel);
} }
this.redraw(); this.redraw();
} }
@ -398,31 +398,31 @@ abstract class Topic extends NodeGraph {
this.redraw(); this.redraw();
} }
setFontSize(value: number): void { setFontSize(value: number) {
const model = this.getModel(); const model = this.getModel();
model.setFontSize(value); model.setFontSize(value);
this.redraw(); this.redraw();
} }
setFontStyle(value: FontStyleType): void { setFontStyle(value: FontStyleType) {
const model = this.getModel(); const model = this.getModel();
model.setFontStyle(value); model.setFontStyle(value);
this.redraw(); this.redraw();
} }
setFontWeight(value: FontWeightType): void { setFontWeight(value: FontWeightType) {
const model = this.getModel(); const model = this.getModel();
model.setFontWeight(value); model.setFontWeight(value);
this.redraw(); this.redraw();
} }
getFontWeight(): FontWeightType { getFontWeight() {
const model = this.getModel(); const model = this.getModel();
let result = model.getFontWeight(); let result = model.getFontWeight();
if (!result) { if (!$defined(result)) {
const font = TopicStyle.defaultFontStyle(this); const font = TopicStyle.defaultFontStyle(this);
result = font.weight; result = font.weight;
} }
@ -611,22 +611,23 @@ abstract class Topic extends NodeGraph {
}; };
elem.addEvent('mouseout', outout); elem.addEvent('mouseout', outout);
const me = this;
// Focus events ... // Focus events ...
elem.addEvent('mousedown', (event: MouseEvent) => { elem.addEvent('mousedown', (event: MouseEvent) => {
const isMac = window.navigator.platform.toUpperCase().indexOf('MAC') >= 0; const isMac = window.navigator.platform.toUpperCase().indexOf('MAC') >= 0;
if (this.isReadOnly()) { if (!me.isReadOnly()) {
// Disable topic selection of readOnly mode ... // Disable topic selection of readOnly mode ...
let value = true; let value = true;
if ((event.metaKey && isMac) || (event.ctrlKey && !isMac)) { if ((event.metaKey && isMac) || (event.ctrlKey && !isMac)) {
value = !this.isOnFocus(); value = !me.isOnFocus();
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();
} }
topic.setOnFocus(value); topic.setOnFocus(value);
} }
const eventDispatcher = this._getTopicEventDispatcher(); const eventDispatcher = me._getTopicEventDispatcher();
eventDispatcher.process(TopicEvent.CLICK, this); eventDispatcher.process(TopicEvent.CLICK, me);
event.stopPropagation(); event.stopPropagation();
}); });
} }