{ "id": "100575", "key": "TIMOB-10805", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2012-09-06T15:15:00.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "api" ], "versions": [ { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "issuelinks": [], "assignee": null, "updated": "2018-02-28T20:03:55.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "This issue occurs because of the interaction of contentWidth/contentHeight with the the size of the scrollview. On iOS, content size can't be less than the size of the scrollview. i.e., the content size is padded to the size of the scrollview. When zoomScale is increased, it is this *padded* content size that's zoomed. Consequently, we get twice as much padding.\r\n\r\nConsider the following test case:\r\n\r\n{code}\r\nimageWin = Ti.UI.createWindow({\r\n backgroundColor:'red',\r\n });\r\n \r\n var scrollView = Ti.UI.createScrollView({\r\n contentWidth: Ti.UI.SIZE,\r\n contentHeight: Ti.UI.SIZE,\r\n backgroundColor: 'white',\r\n maxZoomScale:2,\r\n minZoomScale:1,\r\n zoomScale: 1,\r\n scale: 1\r\n });\r\n \r\n \r\n scrollView.add(Ti.UI.createImageView({\r\n image: 'http://www.nypost.com/rw/nypost/2012/09/05/pagesix/web_photos/red_foo_wireimage--300x300.jpg',\r\n preventDefaultImage: true,\r\n }));\r\n \r\n scrollView.addEventListener('dblclick', function(e) {\r\n if(scrollView.zoomScale == 1) {\r\n scrollView.zoomScale = 2;\r\n scrollView.setContentOffset({x: e.x, y : e.y});\r\n }\r\n else if(scrollView.zoomScale > 1) scrollView.zoomScale = 1;\r\n });\r\n \r\n \r\n imageWin.add(scrollView);\r\n \r\n imageWin.open();\r\n{code}\r\n\r\nInitially, the image is 300x300, smaller than the screen, and scrolling is disabled.\r\n\r\nWhen zoomScale is set to 2, the image is zoomed, but there is a great deal of padding around the image, so it's possible to scroll past the edge of the image and have the scrollview stay there.\r\n\r\nExpected results:\r\n\r\n- When zoomed, the scrollview should have an effective content size of 600 x 600. Scrolling past the edge of the image would cause the scrollview to snap back to the image edge.\r\n\r\nActual results:\r\n\r\n- When zoomed, the effective content size is 640x920, and there's about 160 pixels of padding on the top and bottom of the image.\r\n\r\nThere is workaround for this: if the scrollview has only a single child, like here, the child can either be resized manually (by setting width and height) or scaled using a transform.", "attachment": [], "flagged": false, "summary": "iOS: ScrollView should adjust contentSize appropriately when zoomed", "creator": { "name": "aevans", "key": "aevans", "displayName": "Arthur Evans", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "aevans", "key": "aevans", "displayName": "Arthur Evans", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Actually occurs in SDK 2.1.1 and newer; haven't tested earlier releases. \"Affects Version\" field is currently not showing released version.", "comment": { "comments": [], "maxResults": 0, "total": 0, "startAt": 0 } } }