From 7e0040e7d1b39c2cf2cc3d4793db1dd0f3568c7c Mon Sep 17 00:00:00 2001 From: Seth Benjamin Date: Thu, 9 Jan 2014 12:25:20 -0500 Subject: [PATCH] Fixing a performance issue with iOS and mapped views with many children. --- android/src/ti/draggable/ConfigProxy.java | 4 --- ios/Classes/TiDraggableGesture.m | 9 ++++--- ios/Classes/TiDraggableModule.m | 2 +- ios/Classes/TiViewProxy+ViewProxyExtended.h | 7 +++++ ios/Classes/TiViewProxy+ViewProxyExtended.m | 30 +++++++++++++++++++++ ios/draggable.xcodeproj/project.pbxproj | 8 ++++++ ios/manifest | 2 +- 7 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 ios/Classes/TiViewProxy+ViewProxyExtended.h create mode 100644 ios/Classes/TiViewProxy+ViewProxyExtended.m diff --git a/android/src/ti/draggable/ConfigProxy.java b/android/src/ti/draggable/ConfigProxy.java index e8e3439..f130cd6 100644 --- a/android/src/ti/draggable/ConfigProxy.java +++ b/android/src/ti/draggable/ConfigProxy.java @@ -62,10 +62,6 @@ public ConfigProxy(KrollDict config) properties.put("enabled", config != null && config.containsKeyAndNotNull("enabled") ? TiConvert.toBoolean(config, "enabled", true) : true); properties.put("ensureRight", config != null && config.containsKeyAndNotNull("ensureRight") ? TiConvert.toBoolean(config, "ensureRight", false) : false); properties.put("ensureBottom", config != null && config.containsKeyAndNotNull("ensureBottom") ? TiConvert.toBoolean(config, "ensureBottom", false) : false); - properties.put("minLeft", config != null && config.containsKeyAndNotNull("minLeft") ? TiConvert.toDouble(config, "minLeft") : null); - properties.put("maxLeft", config != null && config.containsKeyAndNotNull("minLeft") ? TiConvert.toDouble(config, "maxLeft") : null); - properties.put("minTop",config != null && config.containsKeyAndNotNull("minTop") ? TiConvert.toDouble(config, "minTop") : null); - properties.put("maxTop", config != null && config.containsKeyAndNotNull("maxTop") ? TiConvert.toDouble(config, "maxTop") : null); properties.put("axis", config != null && config.containsKeyAndNotNull("axis") ? TiConvert.toString(config, "axis") : null); properties.put("maps", config != null && config.containsKeyAndNotNull("maps") ? (Object[]) config.get("maps") : null); diff --git a/ios/Classes/TiDraggableGesture.m b/ios/Classes/TiDraggableGesture.m index 621a9bf..c864515 100644 --- a/ios/Classes/TiDraggableGesture.m +++ b/ios/Classes/TiDraggableGesture.m @@ -34,6 +34,9 @@ * limitations under the License. */ +#import +#import +#import "TiViewProxy+ViewProxyExtended.h" #import "TiDraggableGesture.h" @implementation TiDraggableGesture @@ -333,7 +336,7 @@ - (void)correctMappedProxyPositions layoutProperties->top = TiDimensionDip([proxy view].frame.origin.y); } - [proxy refreshView:nil]; + [proxy respositionEx]; }]; } } @@ -595,8 +598,8 @@ - (void)mapProxyOriginToCollection:(NSArray*)proxies withTranslationX:(float)tra { layoutProperties->right = TiDimensionDip(layoutProperties->left.value * -1); } - - [proxy refreshView:nil]; + + [proxy respositionEx]; }]; } } diff --git a/ios/Classes/TiDraggableModule.m b/ios/Classes/TiDraggableModule.m index 39c5904..4570a65 100644 --- a/ios/Classes/TiDraggableModule.m +++ b/ios/Classes/TiDraggableModule.m @@ -81,7 +81,7 @@ - (id)createProxy:(NSArray*)args forName:(NSString*)name context:(id