diff options
author | Nivesh Rajbhandari | 2012-06-13 13:51:39 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-06-13 13:51:39 -0700 |
commit | 263ecfc95bd7eb5c726cd5688c3d74eb10296811 (patch) | |
tree | 7c907dd58e9b4f4a1d4802d8d22b9c84d3c2edf3 /node_modules/montage/core/extras | |
parent | 1bb2778224982aea7b9781c6559bb659983a400f (diff) | |
parent | a827f2769d75848c0ba0bff03a927c1f2706322b (diff) | |
download | ninja-263ecfc95bd7eb5c726cd5688c3d74eb10296811.tar.gz |
Merge branch 'refs/heads/ninja-internal' into PI_HotTextFixes
Conflicts:
js/panels/properties.reel/sections/position-size.reel/position-size.html
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'node_modules/montage/core/extras')
-rw-r--r-- | node_modules/montage/core/extras/object.js | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/node_modules/montage/core/extras/object.js b/node_modules/montage/core/extras/object.js index 0281240f..d20b57fa 100644 --- a/node_modules/montage/core/extras/object.js +++ b/node_modules/montage/core/extras/object.js | |||
@@ -113,42 +113,27 @@ Object.defineProperty(Object.prototype, "setProperty", { | |||
113 | // TODO clean up some of the duplicated code here | 113 | // TODO clean up some of the duplicated code here |
114 | 114 | ||
115 | if (lastObjectAtPath && Array.isArray(lastObjectAtPath)) { | 115 | if (lastObjectAtPath && Array.isArray(lastObjectAtPath)) { |
116 | if (lastObjectAtPath !== value) { | 116 | |
117 | // if the value does not match the object described by this propertyPath; set it as the new value | 117 | if (Array.isArray(setObject)) { |
118 | 118 | // If the setObject is an array itself; splice (typically called by set) to trigger bindings, do it here to save time | |
119 | if (Array.isArray(setObject)) { | 119 | propertyToSetOnArray = parseInt(aPropertyPath, 10); |
120 | // If the setObject is an array itself; splice (typically called by set) to trigger bindings, do it here to save time | 120 | if (!isNaN(propertyToSetOnArray)) { |
121 | propertyToSetOnArray = parseInt(aPropertyPath, 10); | 121 | if (setObject.length < propertyToSetOnArray) { |
122 | if (!isNaN(propertyToSetOnArray)) { | 122 | // TODO while I could set the value here I'm setting null and letting the splice, |
123 | if (setObject.length < propertyToSetOnArray) { | 123 | // which we need to do anyway to trigger bindings, do the actual setting |
124 | // TODO while I could set the value here I'm setting null and letting the splice, | 124 | setObject[propertyToSetOnArray] = null; |
125 | // which we need to do anyway to trigger bindings, do the actual setting | ||
126 | setObject[propertyToSetOnArray] = null; | ||
127 | } | ||
128 | |||
129 | setObject.splice(propertyToSetOnArray, 1, value); | ||
130 | |||
131 | } else { | ||
132 | setObject[aPropertyPath] = value; | ||
133 | } | 125 | } |
134 | 126 | ||
127 | setObject.splice(propertyToSetOnArray, 1, value); | ||
128 | |||
135 | } else { | 129 | } else { |
136 | setObject[aPropertyPath] = value; | 130 | setObject[aPropertyPath] = value; |
137 | } | 131 | } |
138 | 132 | ||
139 | } else { | 133 | } else { |
140 | // Otherwise, they are the same object, a mutation event probably happened | 134 | setObject[aPropertyPath] = value; |
141 | |||
142 | // If the object at the property we're "setting" is itself an array, see if there was an event passed along | ||
143 | // as part of a change and whether we need to call the setObject's changeProperty method | ||
144 | var changeEvent = this.setProperty.changeEvent, modify; | ||
145 | |||
146 | // For these mutation/addition/removal events, use the 'modify' attribute of this property's descriptor | ||
147 | if (changeEvent && (changeEvent.currentTarget.getProperty(changeEvent.currentPropertyPath) === lastObjectAtPath) && | ||
148 | (modify = M.Montage.getPropertyAttribute(setObject, aPropertyPath, MODIFY))) { | ||
149 | modify.call(setObject, changeEvent.type, changeEvent.newValue, changeEvent.prevValue); | ||
150 | } | ||
151 | } | 135 | } |
136 | |||
152 | } else if (Array.isArray(setObject)) { | 137 | } else if (Array.isArray(setObject)) { |
153 | // If the setObject is an array itself; splice (typically called by set) to trigger bindings, do it here to save time | 138 | // If the setObject is an array itself; splice (typically called by set) to trigger bindings, do it here to save time |
154 | propertyToSetOnArray = parseInt(aPropertyPath, 10); | 139 | propertyToSetOnArray = parseInt(aPropertyPath, 10); |