{"action":"opened","issue":{"url":"https://api.github.com/repos/fengyuanchen/cropperjs/issues/90","repository_url":"https://api.github.com/repos/fengyuanchen/cropperjs","labels_url":"https://api.github.com/repos/fengyuanchen/cropperjs/issues/90/labels{/name}","comments_url":"https://api.github.com/repos/fengyuanchen/cropperjs/issues/90/comments","events_url":"https://api.github.com/repos/fengyuanchen/cropperjs/issues/90/events","html_url":"https://github.com/fengyuanchen/cropperjs/issues/90","id":175394956,"number":90,"title":"Cropper resizing seems to have a bug","user":{"login":"scottbentley","id":7807627,"avatar_url":"https://avatars.githubusercontent.com/u/7807627?v=3","gravatar_id":"","url":"https://api.github.com/users/scottbentley","html_url":"https://github.com/scottbentley","followers_url":"https://api.github.com/users/scottbentley/followers","following_url":"https://api.github.com/users/scottbentley/following{/other_user}","gists_url":"https://api.github.com/users/scottbentley/gists{/gist_id}","starred_url":"https://api.github.com/users/scottbentley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottbentley/subscriptions","organizations_url":"https://api.github.com/users/scottbentley/orgs","repos_url":"https://api.github.com/users/scottbentley/repos","events_url":"https://api.github.com/users/scottbentley/events{/privacy}","received_events_url":"https://api.github.com/users/scottbentley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-09-07T01:58:26Z","updated_at":"2016-09-07T01:58:26Z","closed_at":null,"body":"- Operating system and version\r\n\r\nWindows 10, Ubuntu 14.04.2\r\n\r\n- Browser and version\r\n\r\nlatest Firefox\r\n\r\n---------\r\nI've run into an issue.  I've created an ExtJS component (sencha.com) that encapsulates Cropper.js so that images can be opened/cropped/zoomed/rotated/etc within an ExtJS Window.\r\n\r\nFirst, on resize of the ExtJS Window the encapsulated cropper does not auto-resize (responsive=true).  I don't really get why this is since the div that encapsulates the img is changing size.  I'm not really concerned though because as a workaround I simply did this (pseudocode, example only):\r\n\r\n`\r\n...\r\nExtJSWindowComponent.onResize = function(w,h){\r\n  theCropperInstance.resize();\r\n}\r\n....\r\n`\r\n\r\nNow, the above code works, sort of, but the cropper only resizes when the width changes, and it doesn't really do this correctly because it will expand the height beyond the container height.  My expectation is that the image will stay sized such that it remains scaled into the visible area whether it is the width or height that limits the size, but this isn't the case. Expanding the window width will cause the cropper/image height to expand outside the visible window/container height...yuck.\r\n\r\nTracing things a bit, I have found that when cropper.resize() is run then the variables\r\n\r\ncontainer.offsetWidth\r\ncontainerData.width\r\n\r\nAre changing as one would expect, i.e. when the container is resized the container.offsetWidth changes compared to the containerData.width, and so a resize is triggered.  However, this is not the case for\r\n\r\ncontainer.offsetHeight\r\ncontainerData.height\r\n\r\nInterestingly, when resizing only the container height, these two values will always be equal if the height is contracting, but will be different if the new container height is bigger than the previous height. So, the cropper can be stretched down infinitely, but will never contract back to a smaller size unless the width is also changed.\r\n\r\nAnyways, I've spent too much time trying to figure this out already.  As it is, I can just leave the window statically sized at init, but if you managed to figure out the problem I'd really appreciate it.\r\n\r\nThank you!"}}
{"actor":{"display_login":"scottbentley"}}