Resizable - proportionallyResize
I am tying multiple resizables together using a selectable so that
when one is resized, all other selected ones are resized.
To do this I need to recompute the options.modifyThese array in
Resizable after the Resizable is constructed. This is behavior many
other people will need.
The code in question is here:
//If other elements should be modified, we have to copy that array
options.modifyThese = [];
if(o.proportionallyResize) {
options.proportionallyResize = o.proportionallyResize.slice(0);
var propRes = options.proportionallyResize;
for(var i in propRes) {
if(propRes[i].constructor == String){
propRes[i] = $(propRes[i], el);
}
if(!$(propRes[i]).length) continue;
var x = $(propRes[i]).width() - $(el).width();
var y = $(propRes[i]).height() - $(el).height();
options.modifyThese.push([$(propRes[i]),x,y]);
}
}
I need some tips on how to encapsulate it in its own method in the
resizable plugin and how to call that method within the start method
of that plugin.