Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed method "resetLayer" in terms of deleting layer labels #770

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions addon/components/base-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -664,9 +664,10 @@ export default Ember.Component.extend(
});
}

if (this.get('labelSettings.signMapObjects') && !Ember.isNone(this.get('_labelsLayer')) &&
leafletContainer.hasLayer(this.get('_labelsLayer'))) {
leafletContainer.removeLayer(this.get('_labelsLayer'));
let labelsLayer = this.get('_labelsLayer');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так, ну во-первых, если уж мы озаботились удалением надписей при изменении флага signMapObjects, то как минимум надо это сделать и для additionalZoomLabel (см. выше)

При этом, у нас есть еще и отдельный метод _removeLabelsFromLeafletContainer.
Возможно, разумнее логику по скрытию надписей перенести в него, полностью убрав из _removeLayerFromLeafletContainer. А в метод _destroyLayer добавить вызов _removeLabelsFromLeafletContainer
Возможно нужен какой-то параметр, ибо оба метода _remove... вызываются еще и при отключении видимости слоя. и при включении видимости мы хотим снова увидеть объекты и надписи, которые уже были на карте. Но ты слой не просто убираешь с карты, ты его очищаешь (проверь этот момент, но по-моему надписи обратно не включатся с твоим изменением, если они не в additionalZoomLabel были)

if (!Ember.isNone(labelsLayer) && leafletContainer.hasLayer(labelsLayer)) {
labelsLayer.clearLayers();
leafletContainer.removeLayer(labelsLayer);
}
},

Expand Down
2 changes: 1 addition & 1 deletion addon/components/base-vector-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ export default BaseLayer.extend({
leafletObject.clearLayers();

if (this.get('labelSettings.signMapObjects') && !Ember.isNone(this.get('_labelsLayer')) &&
!Ember.isNone(this.get('_leafletObject._labelsLayeri'))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут опечатка была просто?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Да

!Ember.isNone(this.get('_leafletObject._labelsLayer'))) {
leafletObject._labelsLayer.eachLayer((layerShape) => {
if (map.hasLayer(layerShape)) {
map.removeLayer(layerShape);
Expand Down
Loading