[ 4 posts ]

Ilya Goberman

  • Username: igoberman
  • Joined: Wed Aug 17, 2011 2:11 pm
  • Posts: 66
  • Offline
  • Profile

Resize is not correctly wired to wrapped element.

Post Posted: Mon Feb 27, 2012 12:30 pm
+0-
I am having problem changing size of an element that has a wrapping Resize via setStyle call. If I try to change width of the element and then try to resize it, the width goes back to the original width before setStyle call, so set style did not propagate to the wrapping resize.
What is the correct way to resize the resize? (I already have tried reset and it did not work)

The test is below. Click Resize to set width and then click on the top resize handle. The width gets reset back to the original width. The only way to workaround I found is to destroy() resize and recreate it.
Thanks

<script type="text/javascript" src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
<input id="resize" type="button" value="Resize" onclick="resizeTest(); return false;" />
<div style="background:#CCC;width:200px;height:200px;position:relative;" id="demo"></div>

<script type="text/javascript">
var Y, resize;

function resizeTest() {
Y.one('#demo').setStyle('width', '300px');
}

YUI().use('resize', function (YUI3) {
Y = YUI3;
resize = new Y.Resize({
node: '#demo',
preserveRatio: true,
wrap: true,
handles: 't'
});
});
</script>

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile

Re: Resize is not correctly wired to wrapped element.

Post Posted: Mon Feb 27, 2012 1:34 pm
+0-
Destroying and recreating the resize is the proper thing to do if you want to change the size after the fact.

Ilya Goberman

  • Username: igoberman
  • Joined: Wed Aug 17, 2011 2:11 pm
  • Posts: 66
  • Offline
  • Profile

Re: Resize is not correctly wired to wrapped element.

Post Posted: Mon Feb 27, 2012 1:39 pm
+0-
Hmm, does not seem to be very user friendly, I am afraid. Can't you at least introduce properties in Resize to set size manually?
Thanks for the reply.

Dav Glass

  • Username: davglass
  • Joined: Thu Aug 28, 2008 9:28 am
  • Posts: 2088
  • Location: Marion, IL, US
  • Twitter: davglass
  • GitHub: davglass
  • Gists: davglass
  • IRC: davglass
  • Offline
  • Profile

Re: Resize is not correctly wired to wrapped element.

Post Posted: Mon Feb 27, 2012 1:43 pm
+0-
File a ticket, it's a Utility so its acceptable to destroy it and recreate it..
  [ 4 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
cron