Bug 587248 - Part 8: Fix resizing and drag and drop in RTL mode; r=ian a=blocking-betaN+

This commit is contained in:
Ehsan Akhgari 2010-11-08 01:38:24 -05:00
Родитель 51d4094cad
Коммит 03e047661a
4 изменённых файлов: 22 добавлений и 11 удалений

Просмотреть файл

@ -101,7 +101,8 @@ Drag.prototype = {
//
// Parameters:
// bounds - (<Rect>) bounds
// stationaryCorner - which corner is stationary? by default, the top left.
// stationaryCorner - which corner is stationary? by default, the top left in LTR mode,
// and top right in RTL mode.
// "topleft", "bottomleft", "topright", "bottomright"
// assumeConstantSize - (boolean) whether the bounds' dimensions are sacred or not.
// keepProportional - (boolean) if assumeConstantSize is false, whether we should resize
@ -109,7 +110,7 @@ Drag.prototype = {
// checkItemStatus - (boolean) make sure this is a valid item which should be snapped
snapBounds: function Drag_snapBounds(bounds, stationaryCorner, assumeConstantSize, keepProportional, checkItemStatus) {
if (!stationaryCorner)
stationaryCorner = 'topleft';
stationaryCorner = UI.rtl ? 'topright' : 'topleft';
var update = false; // need to update
var updateX = false;
var updateY = false;
@ -164,7 +165,8 @@ Drag.prototype = {
// trenches that it snapped to.
//
// Parameters:
// stationaryCorner - which corner is stationary? by default, the top left.
// stationaryCorner - which corner is stationary? by default, the top left in LTR mode,
// and top right in RTL mode.
// "topleft", "bottomleft", "topright", "bottomright"
// assumeConstantSize - (boolean) whether the bounds' dimensions are sacred or not.
// keepProportional - (boolean) if assumeConstantSize is false, whether we should resize
@ -187,7 +189,8 @@ Drag.prototype = {
//
// Parameters:
// rect - (<Rect>) current bounds of the object
// stationaryCorner - which corner is stationary? by default, the top left.
// stationaryCorner - which corner is stationary? by default, the top left in LTR mode,
// and top right in RTL mode.
// "topleft", "bottomleft", "topright", "bottomright"
// assumeConstantSize - (boolean) whether the rect's dimensions are sacred or not
// keepProportional - (boolean) if we are allowed to change the rect's size, whether the
@ -258,7 +261,7 @@ Drag.prototype = {
// Function: drag
// Called in response to an <Item> draggable "drag" event.
drag: function Drag_drag(event) {
this.snap('topleft', true);
this.snap(UI.rtl ? 'topright' : 'topleft', true);
if (this.parent && this.parent.expanded) {
var distance = this.startPosition.distance(new Point(event.clientX, event.clientY));

Просмотреть файл

@ -456,8 +456,8 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
if (!options)
options = {};
rect.width = Math.max(110, rect.width);
rect.height = Math.max(125, rect.height);
rect.width = Math.max(90, rect.width);
rect.height = Math.max(90, rect.height);
var titleHeight = this.$titlebar.height();

Просмотреть файл

@ -227,8 +227,7 @@ Item.prototype = {
resizeInfo = new Drag(this, e, true); // true = isResizing
},
resize: function(e,ui) {
// TODO: maybe the stationaryCorner should be topright for rtl langs?
resizeInfo.snap('topleft', false, self.keepProportional);
resizeInfo.snap(UI.rtl ? 'topright' : 'topleft', false, self.keepProportional);
},
stop: function() {
self.setUserSize();
@ -769,7 +768,16 @@ Item.prototype = {
var handleMouseMove = function(e) {
var mouse = new Point(e.pageX, e.pageY);
var box = self.getBounds();
box.width = Math.max(self.resizeOptions.minWidth || 0, startSize.x + (mouse.x - startMouse.x));
if (UI.rtl) {
var minWidth = (self.resizeOptions.minWidth || 0);
var oldWidth = box.width;
if (minWidth != oldWidth || mouse.x < startMouse.x) {
box.width = Math.max(minWidth, startSize.x - (mouse.x - startMouse.x));
box.left -= box.width - oldWidth;
}
} else {
box.width = Math.max(self.resizeOptions.minWidth || 0, startSize.x + (mouse.x - startMouse.x));
}
box.height = Math.max(self.resizeOptions.minHeight || 0, startSize.y + (mouse.y - startMouse.y));
if (self.resizeOptions.aspectRatio) {

Просмотреть файл

@ -477,7 +477,7 @@ var Trenches = {
// preferTop - (boolean) prefer snapping to the top to the bottom
// preferLeft - (boolean) prefer snapping to the left to the right
preferTop: true,
preferLeft: true,
get preferLeft() { return !UI.rtl; },
trenches: [],