Merge pull request #1266 from thecodingmachine/UpdateSetPropertyLayer
SetProperty delete a property where tha value is undefined and load the map of exitUrl property
This commit is contained in:
commit
0a1c01fb26
@ -1077,14 +1077,24 @@ ${escapedMessage}
|
|||||||
console.warn('Could not find layer "' + layerName + '" when calling setProperty');
|
console.warn('Could not find layer "' + layerName + '" when calling setProperty');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (propertyName === "exitUrl" && typeof propertyValue === "string") {
|
||||||
|
this.loadNextGame(propertyValue);
|
||||||
|
}
|
||||||
if (layer.properties === undefined) {
|
if (layer.properties === undefined) {
|
||||||
layer.properties = [];
|
layer.properties = [];
|
||||||
}
|
}
|
||||||
const property = layer.properties.find((property) => property.name === propertyName);
|
const property = layer.properties.find((property) => property.name === propertyName);
|
||||||
if (property === undefined) {
|
if (property === undefined) {
|
||||||
|
if (propertyValue === undefined) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
layer.properties.push({ name: propertyName, type: typeof propertyValue, value: propertyValue });
|
layer.properties.push({ name: propertyName, type: typeof propertyValue, value: propertyValue });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (propertyValue === undefined) {
|
||||||
|
const index = layer.properties.indexOf(property);
|
||||||
|
layer.properties.splice(index, 1);
|
||||||
|
}
|
||||||
property.value = propertyValue;
|
property.value = propertyValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user