#5817 closed bug (fixed)
Resizable: resize event reports unconstrained ui.size when using aspectRatio
Reported by: | ollie2893 | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.10.0 |
Component: | ui.resizable | Version: | 1.8.2 |
Keywords: | resize callback haspatch | Cc: | |
Blocked by: | Blocking: |
Description
Attached is a quick code snippet to illustrate the problem. As you increase the size of the green box, you will notice that it refuses to resize beyond its container, and it preserves the aspectRatio. This is good. But watch at the same time as you drag the resize handle the dimensions reported back in #debug. They keep growing and growing as you keep on dragging even though the green box has ceased resizing. That is, ui.size does not actually report to the event handler the dimensions assigned by ui-resizable.
Although I think this is a major bug, I set priority to "minor" since there is a trivial work-around: do not rely on ui.size but simply read back the CSS attributes instead. Those have been set correctly by ui-resizable just before the event callback.
<style type="text/css">
#container {
background: yellow;
height: 300px; width: 400px;
}
#box {
background: green;
height: 200px; width: 200px;
}
</style>
<script type="text/javascript">
(function() {
eval(myNameSpace());
$(function() {
var box= $("#box")
.resizable({
aspectRatio: true, containment: "#container", resize: function(e,ui) {
$("#debug").text(ui.size.height+" x "+ui.size.width);
}
});
});
})(); </script>
<body>
<div id="container">
<div id="box">
<span id="debug"></span>
</div>
</div>
</body>
Change History (8)
comment:1 Changed 11 years ago by
comment:3 Changed 11 years ago by
Milestone: | TBD → 2.0.0 |
---|
comment:4 Changed 11 years ago by
Keywords: | haspatch added |
---|---|
Status: | new → open |
Summary: | resize event reports unconstrained ui.size → Resizable: resize event reports unconstrained ui.size when using aspectRatio |
Verified this is still an issue in 1.9.1.
comment:7 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
Resizable: Update CSS dimensions selectively. Fixes #7605 - Setting width and height when only one is changing
Resizable: Trigger resize event only when element is resized. Fixes #5545 - Callbacks ignore the grid.
Resizable: Added event tests. Fixes #5817 - resize event reports unconstrained ui.size
Changeset: 3974b55ba5078799df818c78d9273e11d9796ff3
comment:8 Changed 11 years ago by
Milestone: | 2.0.0 → 1.10.0 |
---|
Here is a JS-Bin version of the test case:
http://jsbin.com/ulotum/#html
I've submitted a pull request with a fix and unit tests here:
https://github.com/jquery/jquery-ui/pull/694