{"action":"opened","issue":{"url":"https://api.github.com/repos/kangax/fabric.js/issues/2197","labels_url":"https://api.github.com/repos/kangax/fabric.js/issues/2197/labels{/name}","comments_url":"https://api.github.com/repos/kangax/fabric.js/issues/2197/comments","events_url":"https://api.github.com/repos/kangax/fabric.js/issues/2197/events","html_url":"https://github.com/kangax/fabric.js/issues/2197","id":76730562,"number":2197,"title":"Cannot offset bounding box?","user":{"login":"johnbayne","id":2184406,"avatar_url":"https://avatars.githubusercontent.com/u/2184406?v=3","gravatar_id":"","url":"https://api.github.com/users/johnbayne","html_url":"https://github.com/johnbayne","followers_url":"https://api.github.com/users/johnbayne/followers","following_url":"https://api.github.com/users/johnbayne/following{/other_user}","gists_url":"https://api.github.com/users/johnbayne/gists{/gist_id}","starred_url":"https://api.github.com/users/johnbayne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnbayne/subscriptions","organizations_url":"https://api.github.com/users/johnbayne/orgs","repos_url":"https://api.github.com/users/johnbayne/repos","events_url":"https://api.github.com/users/johnbayne/events{/privacy}","received_events_url":"https://api.github.com/users/johnbayne/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-15T13:43:00Z","updated_at":"2015-05-15T13:43:00Z","closed_at":null,"body":"I'm using fabricJS to create polygons with a size of 1px * 1px. As the user clicks around the canvas, new points are added to the existing polygon, expanding the width & height.\r\n\r\nBecause fabric counts the center as the origin for polygons, in order to prevent the polygon jumping around, I have to manually set the left & top offsets of the shape by running:\r\n\r\n```javascript\r\nshape.left = (initial_left_offset - shape.width/2)\r\nshape.top = (initial_top_offset - shape.width/2)\r\n```\r\nafter adding each point. This works fine.\r\n\r\nThe problem is with the bounding/controls box. The middle of the box is set at the origin (first point) of the polygon, and as much as I try to offset it with \"+ shape.width/2\", the blue controls box won't move. It expands in width & height correctly as I add new points, but the middle of the box is always set to origin. Failed attempts so far:\r\n\r\n* calling shape.setCoords()\r\n* Overriding .setCoords & manually returning tr, tl, br, bl etc values with new coordinates (box still doesn't move)\r\n* Manually setting shape.oCoords & then running shape._setCornerCoords(). Still won't budge\r\n\r\nIf anyone has ideas on how I can ensure the bounding box is set correctly after changing the height & width of the corresponding shape, I'd be appreciative. Despite references to \"controls\" in the above, I don't actually need to use the control box - I just need to be able to pick up mouse:over events (with perPixelTargetFind) across the entire image instead of the bits within the incorrectly-offset bounding box. :-)"}}