Ticket #4666: resizable-alsoresize.patch
File resizable-alsoresize.patch, 2.2 KB (added by , 14 years ago) |
---|
-
ui.resizable.js
531 531 532 532 var self = $(this).data("resizable"), o = self.options; 533 533 534 // The supported values for alsoResize are html elements, 535 // selector string and jQuery object. All of these can be 536 // iterated with the each statement. 534 537 _store = function(exp) { 535 538 $(exp).each(function() { 536 539 $(this).data("resizable-alsoresize", { … … 538 541 left: parseInt($(this).css('left'), 10), top: parseInt($(this).css('top'), 10) 539 542 }); 540 543 }); 541 }; 542 543 if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) { 544 if (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); } 545 else { $.each(o.alsoResize, function(exp, c) { _store(exp); }); } 544 }; 545 546 if (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode && !o.alsoResize.length) { 547 // A dictionary of selectors, where the key stands for the 548 // resizable item and the value is a list of properties that 549 // are modified while being resized. 550 $each(o.alsoResize, function(exp, c) { _store(exp); }); 546 551 }else{ 552 // The objects that can be iterated normally with $(exp).each: 553 // html elements, jQuery object, simple selector string. 547 554 _store(o.alsoResize); 548 555 } 549 556 }, … … 560 567 $(exp).each(function() { 561 568 var el = $(this), start = $(this).data("resizable-alsoresize"), style = {}, css = c && c.length ? c : ['width', 'height', 'top', 'left']; 562 569 563 $.each(css || ['width', 'height', 'top', 'left'], function(i, prop) {570 $.each(css, function(i, prop) { 564 571 var sum = (start[prop]||0) + (delta[prop]||0); 565 572 if (sum && sum >= 0) 566 573 style[prop] = sum || null; … … 576 583 }); 577 584 }; 578 585 579 if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) { 586 // See the start event for the explanation for this conditional. 587 if (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType && !o.alsoResize.length) { 580 588 $.each(o.alsoResize, function(exp, c) { _alsoResize(exp, c); }); 581 589 }else{ 582 590 _alsoResize(o.alsoResize); 583 } 591 } 584 592 }, 585 593 586 594 stop: function(event, ui){