@@ -123,6 +123,11 @@ protected virtual void Update() {
123123 }
124124
125125 protected override void LateUpdate ( ) {
126+ if ( movementType == MovementType . Clamped ) {
127+ base . LateUpdate ( ) ; // Apply clamp on every update
128+ return ;
129+ }
130+
126131 if ( isZooming ) {
127132 isZooming = false ;
128133 this . UpdatePrevData ( ) ; // Avoid dragging in next frame produces inaccurate velocity
@@ -175,8 +180,8 @@ protected virtual void SetContentPivotPosition(Vector2 pivot) {
175180 }
176181
177182 protected virtual void SetContentLocalScale ( Vector3 newScale ) {
178- Rect _rect = content . rect ;
179- Rect _viewRect = viewRect . rect ;
183+ // Rect _rect = content.rect;
184+ // Rect _viewRect = viewRect.rect;
180185 // bool invalidX = _rect.width * newScale.x < _viewRect.width;
181186 // bool invalidY = _rect.height * newScale.y < _viewRect.height;
182187 // if (invalidX) newScale.x = _viewRect.width / _rect.width;
@@ -228,7 +233,7 @@ public override void OnEndDrag(PointerEventData eventData) {
228233
229234#if UNITY_EDITOR
230235 [ UnityEditor . CustomEditor ( typeof ( PinchableScrollRect ) ) ]
231- public class PinchableScrollRectEditor : UnityEditor . Editor {
236+ public class PinchableScrollRectEditor : UnityEditor . UI . ScrollRectEditor {
232237 public override void OnInspectorGUI ( ) {
233238 PinchableScrollRect script = ( PinchableScrollRect ) target ;
234239 if ( script . GetComponent < PinchInputDetector > ( ) == null ) {
@@ -238,6 +243,16 @@ public override void OnInspectorGUI() {
238243 }
239244 }
240245 base . OnInspectorGUI ( ) ;
246+
247+ var flag = System . Reflection . BindingFlags . Public | System . Reflection . BindingFlags . NonPublic | System . Reflection . BindingFlags . Instance ;
248+ foreach ( var field in typeof ( PinchableScrollRect ) . GetFields ( flag ) ) {
249+ var property = serializedObject . FindProperty ( field . Name ) ;
250+ if ( property != null ) {
251+ UnityEditor . EditorGUILayout . PropertyField ( property ) ;
252+ }
253+ }
254+ serializedObject . ApplyModifiedProperties ( ) ;
255+
241256 var _lowerScale = script . lowerScale ;
242257 if ( _lowerScale . x < 1f || _lowerScale . y < 1f || _lowerScale . z < 1f ) {
243258 UnityEditor . EditorGUILayout . HelpBox ( "Lower Scale cannot be less than 1" , UnityEditor . MessageType . Error ) ;
0 commit comments