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 Topic from './Topic';
import Point from '@wisemapping/web2d'; import Point from '@wisemapping/web2d';
import { DesignerOptions } from './DesignerOptions'; import { DesignerOptions } from './DesignerOptions';
import MainTopic from './MainTopic';
class Designer extends Events { class Designer extends Events {
private _mindmap: Mindmap; private _mindmap: Mindmap;
@ -227,14 +228,7 @@ class Designer extends Events {
this._workspace.setZoom(model.getZoom(), true); this._workspace.setZoom(model.getZoom(), true);
} }
/** private _buildNodeGraph(model: NodeModel, readOnly: boolean): MainTopic {
* @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) {
// Create node graph ... // Create node graph ...
const topic = create(model, { readOnly }); const topic = create(model, { readOnly });
this.getModel().addTopic(topic); this.getModel().addTopic(topic);
@ -344,10 +338,6 @@ class Designer extends Events {
this._workspace.setZoom(zoom); this._workspace.setZoom(zoom);
} }
/**
* @param {Number=} factor
* zoom out by the given factor, or 1.2, if undefined
*/
zoomOut(factor: number = 1.2) { zoomOut(factor: number = 1.2) {
const model = this.getModel(); const model = this.getModel();
const scale = model.getZoom() * factor; const scale = model.getZoom() * factor;
@ -912,7 +902,7 @@ class Designer extends Events {
/** */ /** */
changeFontStyle(): void { changeFontStyle(): void {
const topicsIds = this.getModel() const topicsIds = this.getModel()
.filterTopicsIds(); .filterTopicsIds();
if (topicsIds.length > 0) { if (topicsIds.length > 0) {
this._actionDispatcher.changeFontStyleToTopic(topicsIds); this._actionDispatcher.changeFontStyleToTopic(topicsIds);
} }
@ -923,7 +913,7 @@ class Designer extends Events {
$assert(color, 'color can not be null'); $assert(color, 'color can not be null');
const topicsIds = this.getModel() const topicsIds = this.getModel()
.filterTopicsIds(); .filterTopicsIds();
if (topicsIds.length > 0) { if (topicsIds.length > 0) {
this._actionDispatcher.changeFontColorToTopic(topicsIds, color); 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 validateFunc = (topic) => topic.getShapeType() !== TopicShape.LINE;
const validateError = 'Color can not be set to line topics.'; const validateError = 'Color can not be set to line topics.';
const topicsIds = this.getModel().filterTopicsIds(validateFunc, validateError); 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(); const topicsIds = this.getModel().filterTopicsIds();
if (topicsIds.length > 0) { if (topicsIds.length > 0) {
this._actionDispatcher.changeFontSizeToTopic(topicsIds, size); 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 */ /** @param {Number} zoom number between 0.3 and 1.9 to set the zoom to */
setZoom(zoom) { setZoom(zoom:number) {
this._zoom = zoom; this._zoom = zoom;
} }

View File

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