mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
626c409999
--HG-- rename : browser/components/places/Makefile.in => browser/components/tabview/Makefile.in rename : browser/base/content/tabview/content.js => browser/components/tabview/content.js rename : browser/base/content/tabview/drag.js => browser/components/tabview/drag.js rename : browser/base/content/tabview/groupitems.js => browser/components/tabview/groupitems.js rename : browser/base/content/tabview/iq.js => browser/components/tabview/iq.js rename : browser/base/content/tabview/items.js => browser/components/tabview/items.js rename : browser/base/content/tabview/modules/utils.jsm => browser/components/tabview/modules/utils.jsm rename : browser/base/content/tabview/search.js => browser/components/tabview/search.js rename : browser/base/content/tabview/storage.js => browser/components/tabview/storage.js rename : browser/base/content/tabview/storagePolicy.js => browser/components/tabview/storagePolicy.js rename : browser/base/content/tabview/tabitems.js => browser/components/tabview/tabitems.js rename : browser/base/content/tabview/tabview.css => browser/components/tabview/tabview.css rename : browser/base/content/tabview/tabview.html => browser/components/tabview/tabview.html rename : browser/base/content/tabview/tabview.js => browser/components/tabview/tabview.js rename : browser/base/content/test/tabview/Makefile.in => browser/components/tabview/test/Makefile.in rename : browser/base/content/test/tabview/browser_tabview_alltabs.js => browser/components/tabview/test/browser_tabview_alltabs.js rename : browser/base/content/test/tabview/browser_tabview_apptabs.js => browser/components/tabview/test/browser_tabview_apptabs.js rename : browser/base/content/test/tabview/browser_tabview_bug580412.js => browser/components/tabview/test/browser_tabview_bug580412.js rename : browser/base/content/test/tabview/browser_tabview_bug586553.js => browser/components/tabview/test/browser_tabview_bug586553.js rename : browser/base/content/test/tabview/browser_tabview_bug587043.js => browser/components/tabview/test/browser_tabview_bug587043.js rename : browser/base/content/test/tabview/browser_tabview_bug587231.js => browser/components/tabview/test/browser_tabview_bug587231.js rename : browser/base/content/test/tabview/browser_tabview_bug587276.js => browser/components/tabview/test/browser_tabview_bug587276.js rename : browser/base/content/test/tabview/browser_tabview_bug587351.js => browser/components/tabview/test/browser_tabview_bug587351.js rename : browser/base/content/test/tabview/browser_tabview_bug587503.js => browser/components/tabview/test/browser_tabview_bug587503.js rename : browser/base/content/test/tabview/browser_tabview_bug587990.js => browser/components/tabview/test/browser_tabview_bug587990.js rename : browser/base/content/test/tabview/browser_tabview_bug588265.js => browser/components/tabview/test/browser_tabview_bug588265.js rename : browser/base/content/test/tabview/browser_tabview_bug589324.js => browser/components/tabview/test/browser_tabview_bug589324.js rename : browser/base/content/test/tabview/browser_tabview_bug590606.js => browser/components/tabview/test/browser_tabview_bug590606.js rename : browser/base/content/test/tabview/browser_tabview_bug591706.js => browser/components/tabview/test/browser_tabview_bug591706.js rename : browser/base/content/test/tabview/browser_tabview_bug593283.js => browser/components/tabview/test/browser_tabview_bug593283.js rename : browser/base/content/test/tabview/browser_tabview_bug594958.js => browser/components/tabview/test/browser_tabview_bug594958.js rename : browser/base/content/test/tabview/browser_tabview_bug595191.js => browser/components/tabview/test/browser_tabview_bug595191.js rename : browser/base/content/test/tabview/browser_tabview_bug595436.js => browser/components/tabview/test/browser_tabview_bug595436.js rename : browser/base/content/test/tabview/browser_tabview_bug595518.js => browser/components/tabview/test/browser_tabview_bug595518.js rename : browser/base/content/test/tabview/browser_tabview_bug595521.js => browser/components/tabview/test/browser_tabview_bug595521.js rename : browser/base/content/test/tabview/browser_tabview_bug595560.js => browser/components/tabview/test/browser_tabview_bug595560.js rename : browser/base/content/test/tabview/browser_tabview_bug595601.js => browser/components/tabview/test/browser_tabview_bug595601.js rename : browser/base/content/test/tabview/browser_tabview_bug595804.js => browser/components/tabview/test/browser_tabview_bug595804.js rename : browser/base/content/test/tabview/browser_tabview_bug595930.js => browser/components/tabview/test/browser_tabview_bug595930.js rename : browser/base/content/test/tabview/browser_tabview_bug595943.js => browser/components/tabview/test/browser_tabview_bug595943.js rename : browser/base/content/test/tabview/browser_tabview_bug595965.js => browser/components/tabview/test/browser_tabview_bug595965.js rename : browser/base/content/test/tabview/browser_tabview_bug596781.js => browser/components/tabview/test/browser_tabview_bug596781.js rename : browser/base/content/test/tabview/browser_tabview_bug597248.js => browser/components/tabview/test/browser_tabview_bug597248.js rename : browser/base/content/test/tabview/browser_tabview_bug597360.js => browser/components/tabview/test/browser_tabview_bug597360.js rename : browser/base/content/test/tabview/browser_tabview_bug597399.js => browser/components/tabview/test/browser_tabview_bug597399.js rename : browser/base/content/test/tabview/browser_tabview_bug597980.js => browser/components/tabview/test/browser_tabview_bug597980.js rename : browser/base/content/test/tabview/browser_tabview_bug598375.js => browser/components/tabview/test/browser_tabview_bug598375.js rename : browser/base/content/test/tabview/browser_tabview_bug598600.js => browser/components/tabview/test/browser_tabview_bug598600.js rename : browser/base/content/test/tabview/browser_tabview_bug599048.js => browser/components/tabview/test/browser_tabview_bug599048.js rename : browser/base/content/test/tabview/browser_tabview_bug599626.js => browser/components/tabview/test/browser_tabview_bug599626.js rename : browser/base/content/test/tabview/browser_tabview_bug600645.js => browser/components/tabview/test/browser_tabview_bug600645.js rename : browser/base/content/test/tabview/browser_tabview_bug600812.js => browser/components/tabview/test/browser_tabview_bug600812.js rename : browser/base/content/test/tabview/browser_tabview_bug602432.js => browser/components/tabview/test/browser_tabview_bug602432.js rename : browser/base/content/test/tabview/browser_tabview_bug604098.js => browser/components/tabview/test/browser_tabview_bug604098.js rename : browser/base/content/test/tabview/browser_tabview_bug606657.js => browser/components/tabview/test/browser_tabview_bug606657.js rename : browser/base/content/test/tabview/browser_tabview_bug606905.js => browser/components/tabview/test/browser_tabview_bug606905.js rename : browser/base/content/test/tabview/browser_tabview_bug607108.js => browser/components/tabview/test/browser_tabview_bug607108.js rename : browser/base/content/test/tabview/browser_tabview_bug608037.js => browser/components/tabview/test/browser_tabview_bug608037.js rename : browser/base/content/test/tabview/browser_tabview_bug608158.js => browser/components/tabview/test/browser_tabview_bug608158.js rename : browser/base/content/test/tabview/browser_tabview_bug608184.js => browser/components/tabview/test/browser_tabview_bug608184.js rename : browser/base/content/test/tabview/browser_tabview_bug608405.js => browser/components/tabview/test/browser_tabview_bug608405.js rename : browser/base/content/test/tabview/browser_tabview_bug610208.js => browser/components/tabview/test/browser_tabview_bug610208.js rename : browser/base/content/test/tabview/browser_tabview_bug610242.js => browser/components/tabview/test/browser_tabview_bug610242.js rename : browser/base/content/test/tabview/browser_tabview_bug612470.js => browser/components/tabview/test/browser_tabview_bug612470.js rename : browser/base/content/test/tabview/browser_tabview_bug613541.js => browser/components/tabview/test/browser_tabview_bug613541.js rename : browser/base/content/test/tabview/browser_tabview_bug616729.js => browser/components/tabview/test/browser_tabview_bug616729.js rename : browser/base/content/test/tabview/browser_tabview_bug616967.js => browser/components/tabview/test/browser_tabview_bug616967.js rename : browser/base/content/test/tabview/browser_tabview_bug618816.js => browser/components/tabview/test/browser_tabview_bug618816.js rename : browser/base/content/test/tabview/browser_tabview_bug618828.js => browser/components/tabview/test/browser_tabview_bug618828.js rename : browser/base/content/test/tabview/browser_tabview_bug619937.js => browser/components/tabview/test/browser_tabview_bug619937.js rename : browser/base/content/test/tabview/browser_tabview_bug622835.js => browser/components/tabview/test/browser_tabview_bug622835.js rename : browser/base/content/test/tabview/browser_tabview_bug623768.js => browser/components/tabview/test/browser_tabview_bug623768.js rename : browser/base/content/test/tabview/browser_tabview_bug624265.js => browser/components/tabview/test/browser_tabview_bug624265.js rename : browser/base/content/test/tabview/browser_tabview_bug624692.js => browser/components/tabview/test/browser_tabview_bug624692.js rename : browser/base/content/test/tabview/browser_tabview_bug624727.js => browser/components/tabview/test/browser_tabview_bug624727.js rename : browser/base/content/test/tabview/browser_tabview_bug624847.js => browser/components/tabview/test/browser_tabview_bug624847.js rename : browser/base/content/test/tabview/browser_tabview_bug624931.js => browser/components/tabview/test/browser_tabview_bug624931.js rename : browser/base/content/test/tabview/browser_tabview_bug624953.js => browser/components/tabview/test/browser_tabview_bug624953.js rename : browser/base/content/test/tabview/browser_tabview_bug625195.js => browser/components/tabview/test/browser_tabview_bug625195.js rename : browser/base/content/test/tabview/browser_tabview_bug625269.js => browser/components/tabview/test/browser_tabview_bug625269.js rename : browser/base/content/test/tabview/browser_tabview_bug625424.js => browser/components/tabview/test/browser_tabview_bug625424.js rename : browser/base/content/test/tabview/browser_tabview_bug625955.js => browser/components/tabview/test/browser_tabview_bug625955.js rename : browser/base/content/test/tabview/browser_tabview_bug626368.js => browser/components/tabview/test/browser_tabview_bug626368.js rename : browser/base/content/test/tabview/browser_tabview_bug626455.js => browser/components/tabview/test/browser_tabview_bug626455.js rename : browser/base/content/test/tabview/browser_tabview_bug626525.js => browser/components/tabview/test/browser_tabview_bug626525.js rename : browser/base/content/test/tabview/browser_tabview_bug626791.js => browser/components/tabview/test/browser_tabview_bug626791.js rename : browser/base/content/test/tabview/browser_tabview_bug627288.js => browser/components/tabview/test/browser_tabview_bug627288.js rename : browser/base/content/test/tabview/browser_tabview_bug627736.js => browser/components/tabview/test/browser_tabview_bug627736.js rename : browser/base/content/test/tabview/browser_tabview_bug628061.js => browser/components/tabview/test/browser_tabview_bug628061.js rename : browser/base/content/test/tabview/browser_tabview_bug628165.js => browser/components/tabview/test/browser_tabview_bug628165.js rename : browser/base/content/test/tabview/browser_tabview_bug628270.js => browser/components/tabview/test/browser_tabview_bug628270.js rename : browser/base/content/test/tabview/browser_tabview_bug628887.js => browser/components/tabview/test/browser_tabview_bug628887.js rename : browser/base/content/test/tabview/browser_tabview_bug629189.js => browser/components/tabview/test/browser_tabview_bug629189.js rename : browser/base/content/test/tabview/browser_tabview_bug629195.js => browser/components/tabview/test/browser_tabview_bug629195.js rename : browser/base/content/test/tabview/browser_tabview_bug630102.js => browser/components/tabview/test/browser_tabview_bug630102.js rename : browser/base/content/test/tabview/browser_tabview_bug630157.js => browser/components/tabview/test/browser_tabview_bug630157.js rename : browser/base/content/test/tabview/browser_tabview_bug631662.js => browser/components/tabview/test/browser_tabview_bug631662.js rename : browser/base/content/test/tabview/browser_tabview_bug631752.js => browser/components/tabview/test/browser_tabview_bug631752.js rename : browser/base/content/test/tabview/browser_tabview_bug633190.js => browser/components/tabview/test/browser_tabview_bug633190.js rename : browser/base/content/test/tabview/browser_tabview_bug633788.js => browser/components/tabview/test/browser_tabview_bug633788.js rename : browser/base/content/test/tabview/browser_tabview_bug634077.js => browser/components/tabview/test/browser_tabview_bug634077.js rename : browser/base/content/test/tabview/browser_tabview_bug634085.js => browser/components/tabview/test/browser_tabview_bug634085.js rename : browser/base/content/test/tabview/browser_tabview_bug634672.js => browser/components/tabview/test/browser_tabview_bug634672.js rename : browser/base/content/test/tabview/browser_tabview_bug635696.js => browser/components/tabview/test/browser_tabview_bug635696.js rename : browser/base/content/test/tabview/browser_tabview_bug637840.js => browser/components/tabview/test/browser_tabview_bug637840.js rename : browser/base/content/test/tabview/browser_tabview_bug640765.js => browser/components/tabview/test/browser_tabview_bug640765.js rename : browser/base/content/test/tabview/browser_tabview_bug641802.js => browser/components/tabview/test/browser_tabview_bug641802.js rename : browser/base/content/test/tabview/browser_tabview_bug642793.js => browser/components/tabview/test/browser_tabview_bug642793.js rename : browser/base/content/test/tabview/browser_tabview_bug643392.js => browser/components/tabview/test/browser_tabview_bug643392.js rename : browser/base/content/test/tabview/browser_tabview_bug644097.js => browser/components/tabview/test/browser_tabview_bug644097.js rename : browser/base/content/test/tabview/browser_tabview_bug648882.js => browser/components/tabview/test/browser_tabview_bug648882.js rename : browser/base/content/test/tabview/browser_tabview_bug649006.js => browser/components/tabview/test/browser_tabview_bug649006.js rename : browser/base/content/test/tabview/browser_tabview_bug649307.js => browser/components/tabview/test/browser_tabview_bug649307.js rename : browser/base/content/test/tabview/browser_tabview_bug649319.js => browser/components/tabview/test/browser_tabview_bug649319.js rename : browser/base/content/test/tabview/browser_tabview_bug650280.js => browser/components/tabview/test/browser_tabview_bug650280.js rename : browser/base/content/test/tabview/browser_tabview_bug650573.js => browser/components/tabview/test/browser_tabview_bug650573.js rename : browser/base/content/test/tabview/browser_tabview_bug651311.js => browser/components/tabview/test/browser_tabview_bug651311.js rename : browser/base/content/test/tabview/browser_tabview_bug654295.js => browser/components/tabview/test/browser_tabview_bug654295.js rename : browser/base/content/test/tabview/browser_tabview_bug654721.js => browser/components/tabview/test/browser_tabview_bug654721.js rename : browser/base/content/test/tabview/browser_tabview_bug654941.js => browser/components/tabview/test/browser_tabview_bug654941.js rename : browser/base/content/test/tabview/browser_tabview_bug655269.js => browser/components/tabview/test/browser_tabview_bug655269.js rename : browser/base/content/test/tabview/browser_tabview_bug656778.js => browser/components/tabview/test/browser_tabview_bug656778.js rename : browser/base/content/test/tabview/browser_tabview_bug656913.js => browser/components/tabview/test/browser_tabview_bug656913.js rename : browser/base/content/test/tabview/browser_tabview_bug662266.js => browser/components/tabview/test/browser_tabview_bug662266.js rename : browser/base/content/test/tabview/browser_tabview_bug663421.js => browser/components/tabview/test/browser_tabview_bug663421.js rename : browser/base/content/test/tabview/browser_tabview_bug665502.js => browser/components/tabview/test/browser_tabview_bug665502.js rename : browser/base/content/test/tabview/browser_tabview_bug669694.js => browser/components/tabview/test/browser_tabview_bug669694.js rename : browser/base/content/test/tabview/browser_tabview_bug673196.js => browser/components/tabview/test/browser_tabview_bug673196.js rename : browser/base/content/test/tabview/browser_tabview_bug673729.js => browser/components/tabview/test/browser_tabview_bug673729.js rename : browser/base/content/test/tabview/browser_tabview_bug677310.js => browser/components/tabview/test/browser_tabview_bug677310.js rename : browser/base/content/test/tabview/browser_tabview_bug679853.js => browser/components/tabview/test/browser_tabview_bug679853.js rename : browser/base/content/test/tabview/browser_tabview_bug681599.js => browser/components/tabview/test/browser_tabview_bug681599.js rename : browser/base/content/test/tabview/browser_tabview_bug685476.js => browser/components/tabview/test/browser_tabview_bug685476.js rename : browser/base/content/test/tabview/browser_tabview_bug685692.js => browser/components/tabview/test/browser_tabview_bug685692.js rename : browser/base/content/test/tabview/browser_tabview_bug686654.js => browser/components/tabview/test/browser_tabview_bug686654.js rename : browser/base/content/test/tabview/browser_tabview_click_group.js => browser/components/tabview/test/browser_tabview_click_group.js rename : browser/base/content/test/tabview/browser_tabview_dragdrop.js => browser/components/tabview/test/browser_tabview_dragdrop.js rename : browser/base/content/test/tabview/browser_tabview_exit_button.js => browser/components/tabview/test/browser_tabview_exit_button.js rename : browser/base/content/test/tabview/browser_tabview_expander.js => browser/components/tabview/test/browser_tabview_expander.js rename : browser/base/content/test/tabview/browser_tabview_firstrun_pref.js => browser/components/tabview/test/browser_tabview_firstrun_pref.js rename : browser/base/content/test/tabview/browser_tabview_group.js => browser/components/tabview/test/browser_tabview_group.js rename : browser/base/content/test/tabview/browser_tabview_launch.js => browser/components/tabview/test/browser_tabview_launch.js rename : browser/base/content/test/tabview/browser_tabview_layout.js => browser/components/tabview/test/browser_tabview_layout.js rename : browser/base/content/test/tabview/browser_tabview_multiwindow_search.js => browser/components/tabview/test/browser_tabview_multiwindow_search.js rename : browser/base/content/test/tabview/browser_tabview_privatebrowsing.js => browser/components/tabview/test/browser_tabview_privatebrowsing.js rename : browser/base/content/test/tabview/browser_tabview_rtl.js => browser/components/tabview/test/browser_tabview_rtl.js rename : browser/base/content/test/tabview/browser_tabview_search.js => browser/components/tabview/test/browser_tabview_search.js rename : browser/base/content/test/tabview/browser_tabview_snapping.js => browser/components/tabview/test/browser_tabview_snapping.js rename : browser/base/content/test/tabview/browser_tabview_startup_transitions.js => browser/components/tabview/test/browser_tabview_startup_transitions.js rename : browser/base/content/test/tabview/browser_tabview_storage_policy.js => browser/components/tabview/test/browser_tabview_storage_policy.js rename : browser/base/content/test/tabview/browser_tabview_thumbnail_storage.js => browser/components/tabview/test/browser_tabview_thumbnail_storage.js rename : browser/base/content/test/tabview/browser_tabview_undo_group.js => browser/components/tabview/test/browser_tabview_undo_group.js rename : browser/base/content/test/tabview/dummy_page.html => browser/components/tabview/test/dummy_page.html rename : browser/base/content/test/tabview/head.js => browser/components/tabview/test/head.js rename : browser/base/content/test/tabview/search1.html => browser/components/tabview/test/search1.html rename : browser/base/content/test/tabview/search2.html => browser/components/tabview/test/search2.html rename : browser/base/content/test/tabview/test_bug600645.html => browser/components/tabview/test/test_bug600645.html rename : browser/base/content/test/tabview/test_bug644097.html => browser/components/tabview/test/test_bug644097.html rename : browser/base/content/tabview/thumbnailStorage.js => browser/components/tabview/thumbnailStorage.js rename : browser/base/content/tabview/trench.js => browser/components/tabview/trench.js rename : browser/base/content/tabview/ui.js => browser/components/tabview/ui.js
303 lines
10 KiB
JavaScript
303 lines
10 KiB
JavaScript
/* ***** BEGIN LICENSE BLOCK *****
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
*
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
* the License. You may obtain a copy of the License at
|
|
* http://www.mozilla.org/MPL/
|
|
*
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
* for the specific language governing rights and limitations under the
|
|
* License.
|
|
*
|
|
* The Original Code is drag.js.
|
|
*
|
|
* The Initial Developer of the Original Code is
|
|
* the Mozilla Foundation.
|
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
|
* the Initial Developer. All Rights Reserved.
|
|
*
|
|
* Contributor(s):
|
|
* Michael Yoshitaka Erlewine <mitcho@mitcho.com>
|
|
*
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
* the provisions above, a recipient may use your version of this file under
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
*
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
// **********
|
|
// Title: drag.js
|
|
|
|
// ----------
|
|
// Variable: drag
|
|
// The Drag that's currently in process.
|
|
var drag = {
|
|
info: null,
|
|
zIndex: 100,
|
|
lastMoveTime: 0
|
|
};
|
|
|
|
//----------
|
|
//Variable: resize
|
|
//The resize (actually a Drag) that is currently in process
|
|
var resize = {
|
|
info: null,
|
|
lastMoveTime: 0
|
|
};
|
|
|
|
// ##########
|
|
// Class: Drag (formerly DragInfo)
|
|
// Helper class for dragging <Item>s
|
|
//
|
|
// ----------
|
|
// Constructor: Drag
|
|
// Called to create a Drag in response to an <Item> draggable "start" event.
|
|
// Note that it is also used partially during <Item>'s resizable method as well.
|
|
//
|
|
// Parameters:
|
|
// item - The <Item> being dragged
|
|
// event - The DOM event that kicks off the drag
|
|
function Drag(item, event) {
|
|
Utils.assert(item && (item.isAnItem || item.isAFauxItem),
|
|
'must be an item, or at least a faux item');
|
|
|
|
this.item = item;
|
|
this.el = item.container;
|
|
this.$el = iQ(this.el);
|
|
this.parent = this.item.parent;
|
|
this.startPosition = new Point(event.clientX, event.clientY);
|
|
this.startTime = Date.now();
|
|
|
|
this.item.isDragging = true;
|
|
this.item.setZ(999999);
|
|
|
|
this.safeWindowBounds = Items.getSafeWindowBounds();
|
|
|
|
Trenches.activateOthersTrenches(this.el);
|
|
};
|
|
|
|
Drag.prototype = {
|
|
// ----------
|
|
// Function: toString
|
|
// Prints [Drag (item)] for debug use
|
|
toString: function Drag_toString() {
|
|
return "[Drag (" + this.item + ")]";
|
|
},
|
|
|
|
// ----------
|
|
// Function: snapBounds
|
|
// Adjusts the given bounds according to the currently active trenches. Used by <Drag.snap>
|
|
//
|
|
// Parameters:
|
|
// bounds - (<Rect>) bounds
|
|
// 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
|
|
// proportionally or not
|
|
// 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 = UI.rtl ? 'topright' : 'topleft';
|
|
var update = false; // need to update
|
|
var updateX = false;
|
|
var updateY = false;
|
|
var newRect;
|
|
var snappedTrenches = {};
|
|
|
|
// OH SNAP!
|
|
|
|
// if we aren't holding down the meta key or have trenches disabled...
|
|
if (!Keys.meta && !Trenches.disabled) {
|
|
// snappable = true if we aren't a tab on top of something else, and
|
|
// there's no active drop site...
|
|
let snappable = !(this.item.isATabItem &&
|
|
this.item.overlapsWithOtherItems()) &&
|
|
!iQ(".acceptsDrop").length;
|
|
if (!checkItemStatus || snappable) {
|
|
newRect = Trenches.snap(bounds, stationaryCorner, assumeConstantSize,
|
|
keepProportional);
|
|
if (newRect) { // might be false if no changes were made
|
|
update = true;
|
|
snappedTrenches = newRect.snappedTrenches || {};
|
|
bounds = newRect;
|
|
}
|
|
}
|
|
}
|
|
|
|
// make sure the bounds are in the window.
|
|
newRect = this.snapToEdge(bounds, stationaryCorner, assumeConstantSize,
|
|
keepProportional);
|
|
if (newRect) {
|
|
update = true;
|
|
bounds = newRect;
|
|
Utils.extend(snappedTrenches, newRect.snappedTrenches);
|
|
}
|
|
|
|
Trenches.hideGuides();
|
|
for (var edge in snappedTrenches) {
|
|
var trench = snappedTrenches[edge];
|
|
if (typeof trench == 'object') {
|
|
trench.showGuide = true;
|
|
trench.show();
|
|
}
|
|
}
|
|
|
|
return update ? bounds : false;
|
|
},
|
|
|
|
// ----------
|
|
// Function: snap
|
|
// Called when a drag or mousemove occurs. Set the bounds based on the mouse move first, then
|
|
// call snap and it will adjust the item's bounds if appropriate. Also triggers the display of
|
|
// trenches that it snapped to.
|
|
//
|
|
// Parameters:
|
|
// 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
|
|
// proportionally or not
|
|
snap: function Drag_snap(stationaryCorner, assumeConstantSize, keepProportional) {
|
|
var bounds = this.item.getBounds();
|
|
bounds = this.snapBounds(bounds, stationaryCorner, assumeConstantSize, keepProportional, true);
|
|
if (bounds) {
|
|
this.item.setBounds(bounds, true);
|
|
return true;
|
|
}
|
|
return false;
|
|
},
|
|
|
|
// --------
|
|
// Function: snapToEdge
|
|
// Returns a version of the bounds snapped to the edge if it is close enough. If not,
|
|
// returns false. If <Keys.meta> is true, this function will simply enforce the
|
|
// window edges.
|
|
//
|
|
// Parameters:
|
|
// rect - (<Rect>) current bounds of the object
|
|
// 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
|
|
// dimensions should scaled proportionally or not.
|
|
snapToEdge: function Drag_snapToEdge(rect, stationaryCorner, assumeConstantSize, keepProportional) {
|
|
|
|
var swb = this.safeWindowBounds;
|
|
var update = false;
|
|
var updateX = false;
|
|
var updateY = false;
|
|
var snappedTrenches = {};
|
|
|
|
var snapRadius = (Keys.meta ? 0 : Trenches.defaultRadius);
|
|
if (rect.left < swb.left + snapRadius ) {
|
|
if (stationaryCorner.indexOf('right') > -1 && !assumeConstantSize)
|
|
rect.width = rect.right - swb.left;
|
|
rect.left = swb.left;
|
|
update = true;
|
|
updateX = true;
|
|
snappedTrenches.left = 'edge';
|
|
}
|
|
|
|
if (rect.right > swb.right - snapRadius) {
|
|
if (updateX || !assumeConstantSize) {
|
|
var newWidth = swb.right - rect.left;
|
|
if (keepProportional)
|
|
rect.height = rect.height * newWidth / rect.width;
|
|
rect.width = newWidth;
|
|
update = true;
|
|
} else if (!updateX || !Trenches.preferLeft) {
|
|
rect.left = swb.right - rect.width;
|
|
update = true;
|
|
}
|
|
snappedTrenches.right = 'edge';
|
|
delete snappedTrenches.left;
|
|
}
|
|
if (rect.top < swb.top + snapRadius) {
|
|
if (stationaryCorner.indexOf('bottom') > -1 && !assumeConstantSize)
|
|
rect.height = rect.bottom - swb.top;
|
|
rect.top = swb.top;
|
|
update = true;
|
|
updateY = true;
|
|
snappedTrenches.top = 'edge';
|
|
}
|
|
if (rect.bottom > swb.bottom - snapRadius) {
|
|
if (updateY || !assumeConstantSize) {
|
|
var newHeight = swb.bottom - rect.top;
|
|
if (keepProportional)
|
|
rect.width = rect.width * newHeight / rect.height;
|
|
rect.height = newHeight;
|
|
update = true;
|
|
} else if (!updateY || !Trenches.preferTop) {
|
|
rect.top = swb.bottom - rect.height;
|
|
update = true;
|
|
}
|
|
snappedTrenches.top = 'edge';
|
|
delete snappedTrenches.bottom;
|
|
}
|
|
|
|
if (update) {
|
|
rect.snappedTrenches = snappedTrenches;
|
|
return rect;
|
|
}
|
|
return false;
|
|
},
|
|
|
|
// ----------
|
|
// Function: drag
|
|
// Called in response to an <Item> draggable "drag" event.
|
|
drag: function Drag_drag(event) {
|
|
this.snap(UI.rtl ? 'topright' : 'topleft', true);
|
|
|
|
if (this.parent && this.parent.expanded) {
|
|
var distance = this.startPosition.distance(new Point(event.clientX, event.clientY));
|
|
if (distance > 100) {
|
|
this.parent.remove(this.item);
|
|
this.parent.collapse();
|
|
}
|
|
}
|
|
},
|
|
|
|
// ----------
|
|
// Function: stop
|
|
// Called in response to an <Item> draggable "stop" event.
|
|
//
|
|
// Parameters:
|
|
// immediately - bool for doing the pushAway immediately, without animation
|
|
stop: function Drag_stop(immediately) {
|
|
Trenches.hideGuides();
|
|
this.item.isDragging = false;
|
|
|
|
if (this.parent && this.parent != this.item.parent)
|
|
this.parent.closeIfEmpty();
|
|
|
|
if (this.parent && this.parent.expanded)
|
|
this.parent.arrange();
|
|
|
|
if (this.item.parent)
|
|
this.item.parent.arrange();
|
|
|
|
if (this.item.isAGroupItem) {
|
|
this.item.setZ(drag.zIndex);
|
|
drag.zIndex++;
|
|
|
|
this.item.pushAway(immediately);
|
|
}
|
|
|
|
Trenches.disactivate();
|
|
}
|
|
};
|