Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2164)

Unified Diff: chrome/browser/resources/options/chromeos/display_layout_manager_multi.js

Issue 2562783002: Fix collision calculation (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/options/chromeos/display_layout.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/chromeos/display_layout_manager_multi.js
diff --git a/chrome/browser/resources/options/chromeos/display_layout_manager_multi.js b/chrome/browser/resources/options/chromeos/display_layout_manager_multi.js
index e26becaa38fcaaba2c189b777fa12d3ea726bf96..1c9400e8856ce532db32fb0ddea666d7ae5b52e5 100644
--- a/chrome/browser/resources/options/chromeos/display_layout_manager_multi.js
+++ b/chrome/browser/resources/options/chromeos/display_layout_manager_multi.js
@@ -56,7 +56,7 @@ cr.define('options', function() {
var deltaPos = {x: newPos.x - oldPos.x, y: newPos.y - oldPos.y};
// Check for collisions.
- this.collideAndModifyDelta_(layout, deltaPos);
+ this.collideAndModifyDelta_(layout, oldPos, deltaPos);
if (deltaPos.x == 0 && deltaPos.y == 0)
return;
@@ -194,7 +194,7 @@ cr.define('options', function() {
var deltaPos = {x: pos.x - cornerPos.x, y: pos.y - cornerPos.y};
// Check for collisions.
- this.collideAndModifyDelta_(orphan, deltaPos);
+ this.collideAndModifyDelta_(orphan, cornerPos, deltaPos);
pos = {x: cornerPos.x + deltaPos.x, y: cornerPos.y + deltaPos.y};
// Update the div and adjust the corners.
@@ -279,13 +279,14 @@ cr.define('options', function() {
},
/**
- * Intersects |layout| with each other layout and reduces |deltaPos| to
- * avoid any collisions (or sets it to [0,0] if the div can not be moved
- * in the direction of |deltaPos|).
+ * Intersects |layout| at |pos| with each other layout and reduces
+ * |deltaPos| to avoid any collisions (or sets it to [0,0] if the div can
+ * not be moved in the direction of |deltaPos|).
* @param {!options.DisplayLayout} layout
+ * @param {!options.DisplayPosition} pos
* @param {!options.DisplayPosition} deltaPos
*/
- collideAndModifyDelta_: function(layout, deltaPos) {
+ collideAndModifyDelta_: function(layout, pos, deltaPos) {
var keys = Object.keys(
/** @type {!Object<!options.DisplayLayout>}*/ (
this.displayLayoutMap_));
@@ -296,7 +297,7 @@ cr.define('options', function() {
checkCollisions = false;
for (var tid of others) {
var tlayout = this.displayLayoutMap_[tid];
- if (layout.collideWithDivAndModifyDelta(tlayout.div, deltaPos)) {
+ if (layout.collideWithDivAndModifyDelta(pos, tlayout.div, deltaPos)) {
if (deltaPos.x == 0 && deltaPos.y == 0)
return;
others.delete(tid);
« no previous file with comments | « chrome/browser/resources/options/chromeos/display_layout.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698