Fix composite object implementation to also map properties for the initial properties passed to the factory

master
Sven Slootweg 7 years ago
parent 7805c2fe06
commit b28c927d81

@ -17,6 +17,7 @@ function getPosition(object) {
module.exports = function createCompositeObject(options) { module.exports = function createCompositeObject(options) {
let mapProperties = createPropertyMapper(options.propertyMap); let mapProperties = createPropertyMapper(options.propertyMap);
let initialPropertySet = mapProperties(options);
let compositeObject = createObject(Object.assign({ let compositeObject = createObject(Object.assign({
onSet: function setCompositeProperties(properties) { onSet: function setCompositeProperties(properties) {
@ -77,7 +78,7 @@ module.exports = function createCompositeObject(options) {
offsetY: y1 offsetY: y1
} }
} }
}, options)); }, initialPropertySet._));
Object.keys(compositeObject.objects).forEach((objectName) => { Object.keys(compositeObject.objects).forEach((objectName) => {
compositeObject.objects[objectName].on("recalculatedSize", () => { compositeObject.objects[objectName].on("recalculatedSize", () => {
@ -89,5 +90,6 @@ module.exports = function createCompositeObject(options) {
}); });
}); });
compositeObject.set(options);
return compositeObject; return compositeObject;
}; };

Loading…
Cancel
Save