From ab4817416569f21253e06d9927f8f8ebd29b04f9 Mon Sep 17 00:00:00 2001 From: KirillovIlya Date: Wed, 11 Nov 2020 15:32:19 +0300 Subject: [PATCH] Improve performance --- apps/common/main/lib/component/ComboBoxFonts.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/apps/common/main/lib/component/ComboBoxFonts.js b/apps/common/main/lib/component/ComboBoxFonts.js index 7073ef1d9..070536ade 100644 --- a/apps/common/main/lib/component/ComboBoxFonts.js +++ b/apps/common/main/lib/component/ComboBoxFonts.js @@ -341,16 +341,21 @@ define([ onApiChangeFont: function(font) { var me = this; - setTimeout(function () { - me.onApiChangeFontInternal(font); - }, 100); + var name = (_.isFunction(font.get_Name) ? font.get_Name() : font.asc_getFontName()); + if (this.__name !== name) { + this.__name = name; + if (!this.__nameId) { + this.__nameId = setTimeout(function () { + me.onApiChangeFontInternal(me.__name); + me.__nameId = null; + }, 100); + } + } }, - onApiChangeFontInternal: function(font) { + onApiChangeFontInternal: function(name) { if (this.inFormControl) return; - var name = (_.isFunction(font.get_Name) ? font.get_Name() : font.asc_getFontName()); - if (this.getRawValue() !== name) { var record = this.store.findWhere({ name: name