From d472b39b428b50306b0b9416c3405ddaa322a675 Mon Sep 17 00:00:00 2001 From: Abramova Snezhana Date: Thu, 5 Oct 2023 14:25:45 +0500 Subject: [PATCH] fix smell code --- addon/mixins/layer-label.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/addon/mixins/layer-label.js b/addon/mixins/layer-label.js index 9065f9729..ee304f224 100644 --- a/addon/mixins/layer-label.js +++ b/addon/mixins/layer-label.js @@ -1339,19 +1339,10 @@ export default Ember.Mixin.create({ labelsLayers = this.get('labelsLayers'); if (labelsLayers && labelsLayers.length > 0) { this._additionalZoomLabelPane(); - let buffer = 150; labelsLayers.forEach(labelLayer => { leafletContainer.addLayer(labelLayer); labelLayer.eachLayer(layer => { - if (this.get('typeGeometry') === 'polyline' && !Ember.isNone(layer._path) && !Ember.isNone(layer._svg)) { - let bbox = document.getElementById(Ember.$(layer._path)[0].getAttribute('id')).getBBox(); - if (!Ember.isNone(bbox)) { - layer._svg.setAttribute('height', bbox.height + buffer); - layer._svg.setAttribute('width', bbox.width + buffer); - document.getElementById(Ember.$(layer._svg)[0].getAttribute('id')).setAttribute('height', bbox.height + buffer); - document.getElementById(Ember.$(layer._svg)[0].getAttribute('id')).setAttribute('width', bbox.width + buffer); - } - } + this._setOptionsForSvg(layer); }); }); } @@ -1365,6 +1356,19 @@ export default Ember.Mixin.create({ } }, + _setOptionsForSvg(layer) { + let buffer = 150; + if (this.get('typeGeometry') === 'polyline' && !Ember.isNone(layer._path) && !Ember.isNone(layer._svg)) { + let bbox = document.getElementById(Ember.$(layer._path)[0].getAttribute('id')).getBBox(); + if (!Ember.isNone(bbox)) { + layer._svg.setAttribute('height', bbox.height + buffer); + layer._svg.setAttribute('width', bbox.width + buffer); + document.getElementById(Ember.$(layer._svg)[0].getAttribute('id')).setAttribute('height', bbox.height + buffer); + document.getElementById(Ember.$(layer._svg)[0].getAttribute('id')).setAttribute('width', bbox.width + buffer); + } + } + }, + /** Check label layer in continer.