SetProperty delete a property where tha value is undefined and load the map of exitUrl property
This commit is contained in:
parent
e5f7c62e25
commit
24811e0a31
@ -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