Skip to content

Commit

Permalink
Avoid errors by checking layer existence
Browse files Browse the repository at this point in the history
  • Loading branch information
dersmon committed Aug 2, 2024
1 parent c23f479 commit 574d9c9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions publication/assets/js/document-view-map-hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ export default getDocumentViewMapHook = () => {
this.identifierOverlay.setPosition(coordinate);
},
setFillForParents(val) {
if (!this.parentLayer) return;
let parentFeatures = this.parentLayer.getSource().getFeatures();
for (let parent of parentFeatures) {
let properties = parent.getProperties();
Expand All @@ -399,12 +400,14 @@ export default getDocumentViewMapHook = () => {
}
},
setFillForSelectedDocument(val) {
if (!this.docLayer) return;
let docFeature = this.docLayer.getSource().getFeatures()[0];
let properties = docFeature.getProperties();
properties.fill = val;
docFeature.setProperties(properties);
},
setFillForChildren(val) {
if (!this.childrenLayer) return;
let childFeatures = this.childrenLayer.getSource().getFeatures();
for (let child of childFeatures) {
let properties = child.getProperties();
Expand Down

0 comments on commit 574d9c9

Please sign in to comment.