Skip to content

Commit

Permalink
fix smell code
Browse files Browse the repository at this point in the history
  • Loading branch information
SnezhanaAbramova committed Oct 5, 2023
1 parent ddf1975 commit d472b39
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions addon/mixins/layer-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
}
Expand All @@ -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.
Expand Down

0 comments on commit d472b39

Please sign in to comment.