Fix change font regression

This commit is contained in:
Paulo Gustavo Veiga 2022-01-08 16:02:48 -08:00
parent a0a5beb2ec
commit 934d127012
3 changed files with 16 additions and 23 deletions

View File

@ -55,6 +55,7 @@ import NodeModel from './model/NodeModel';
import Topic from './Topic';
import Point from '@wisemapping/web2d';
import { DesignerOptions } from './DesignerOptions';
import MainTopic from './MainTopic';
class Designer extends Events {
private _mindmap: Mindmap;
@ -227,14 +228,7 @@ class Designer extends Events {
this._workspace.setZoom(model.getZoom(), true);
}
/**
* @private
* @param {mindplot.model.NodeModel} model
* @param {Boolean} readOnly
* @return {mindplot.CentralTopic|mindplot.MainTopic} the topic to the given model,
* connected, added to the drag manager, with events registered - complying type & read mode
*/
_buildNodeGraph(model: NodeModel, readOnly: boolean) {
private _buildNodeGraph(model: NodeModel, readOnly: boolean): MainTopic {
// Create node graph ...
const topic = create(model, { readOnly });
this.getModel().addTopic(topic);
@ -344,10 +338,6 @@ class Designer extends Events {
this._workspace.setZoom(zoom);
}
/**
* @param {Number=} factor
* zoom out by the given factor, or 1.2, if undefined
*/
zoomOut(factor: number = 1.2) {
const model = this.getModel();
const scale = model.getZoom() * factor;
@ -912,7 +902,7 @@ class Designer extends Events {
/** */
changeFontStyle(): void {
const topicsIds = this.getModel()
.filterTopicsIds();
.filterTopicsIds();
if (topicsIds.length > 0) {
this._actionDispatcher.changeFontStyleToTopic(topicsIds);
}
@ -923,7 +913,7 @@ class Designer extends Events {
$assert(color, 'color can not be null');
const topicsIds = this.getModel()
.filterTopicsIds();
.filterTopicsIds();
if (topicsIds.length > 0) {
this._actionDispatcher.changeFontColorToTopic(topicsIds, color);
}
@ -941,7 +931,7 @@ class Designer extends Events {
}
/** */
changeBorderColor(color:string) {
changeBorderColor(color: string) {
const validateFunc = (topic) => topic.getShapeType() !== TopicShape.LINE;
const validateError = 'Color can not be set to line topics.';
const topicsIds = this.getModel().filterTopicsIds(validateFunc, validateError);
@ -951,7 +941,7 @@ class Designer extends Events {
}
/** */
changeFontSize(size:number) {
changeFontSize(size: number) {
const topicsIds = this.getModel().filterTopicsIds();
if (topicsIds.length > 0) {
this._actionDispatcher.changeFontSizeToTopic(topicsIds, size);

View File

@ -40,7 +40,7 @@ class DesignerModel extends Events {
}
/** @param {Number} zoom number between 0.3 and 1.9 to set the zoom to */
setZoom(zoom) {
setZoom(zoom:number) {
this._zoom = zoom;
}

View File

@ -27,12 +27,15 @@ class ListToolbarPanel extends ToolbarPaneItem {
_initPanel() {
// Register on toolbar elements ...
this.getPanelElem().children('div').bind('click', (event) => {
event.stopPropagation();
this.hide();
const value = $defined($(this).attr('model')) ? $(this).attr('model') : $(this).attr('id');
this.getModel().setValue(value);
});
const me = this;
this.getPanelElem()
.children('div')
.bind('click', function click(event) {
event.stopPropagation();
me.hide();
const value = $defined($(this).attr('model')) ? $(this).attr('model') : $(this).attr('id');
me.getModel().setValue(value);
});
}
_updateSelectedItem() {