From b28c927d81f4eeecf1f6bb4ff56bfd76a9e426d5 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Sun, 12 Mar 2017 21:29:26 +0100 Subject: [PATCH] Fix composite object implementation to also map properties for the initial properties passed to the factory --- src/create-composite-object.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/create-composite-object.js b/src/create-composite-object.js index 291154d..e163ca7 100644 --- a/src/create-composite-object.js +++ b/src/create-composite-object.js @@ -17,6 +17,7 @@ function getPosition(object) { module.exports = function createCompositeObject(options) { let mapProperties = createPropertyMapper(options.propertyMap); + let initialPropertySet = mapProperties(options); let compositeObject = createObject(Object.assign({ onSet: function setCompositeProperties(properties) { @@ -77,7 +78,7 @@ module.exports = function createCompositeObject(options) { offsetY: y1 } } - }, options)); + }, initialPropertySet._)); Object.keys(compositeObject.objects).forEach((objectName) => { compositeObject.objects[objectName].on("recalculatedSize", () => { @@ -89,5 +90,6 @@ module.exports = function createCompositeObject(options) { }); }); + compositeObject.set(options); return compositeObject; };