mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
don't snap to anything (except edges) if you're on top of another group (fixes bug reported by Aza: snapping onto another group)
This commit is contained in:
parent
81aa471969
commit
d0875e4220
@ -100,7 +100,9 @@ Drag.prototype = {
|
||||
var newRect;
|
||||
|
||||
// OH SNAP!
|
||||
if (!Keys.meta) { // if we aren't holding down the meta key...
|
||||
if ( !Keys.meta // if we aren't holding down the meta key...
|
||||
&& !this.item.overlapsWithOtherItems() // and we aren't on top of anything else...
|
||||
) {
|
||||
newRect = Trenches.snap(bounds,assumeConstantSize,keepProportional);
|
||||
if (newRect) { // might be false if no changes were made
|
||||
update = true;
|
||||
|
@ -238,6 +238,21 @@ window.Item.prototype = {
|
||||
return new Rect(this.bounds);
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: overlapsWithOtherItems
|
||||
// Returns true if this Item overlaps with any other Item on the screen.
|
||||
overlapsWithOtherItems: function() {
|
||||
var self = this;
|
||||
var items = Items.getTopLevelItems();
|
||||
var bounds = this.getBounds();
|
||||
return items.some(function(item) {
|
||||
if (item == self) // can't overlap with yourself.
|
||||
return false;
|
||||
var myBounds = item.getBounds();
|
||||
return myBounds.intersects(bounds);
|
||||
} );
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: setPosition
|
||||
// Moves the Item to the specified location.
|
||||
|
Loading…
Reference in New Issue
Block a user