From a48dd56bf00c563ca15f58de0b7a6aa12ce62a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20J=C3=B8rgen=20Br=C3=B8nner?= Date: Mon, 13 Jan 2020 20:33:56 +0100 Subject: [PATCH] Space.globalToSpace coordinate transform util --- tiling.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tiling.js b/tiling.js index dbfdd2e..0995bea 100644 --- a/tiling.js +++ b/tiling.js @@ -774,6 +774,14 @@ class Space extends Array { return column.indexOf(metaWindow); } + /** Transform global coordinates to scroll cooridinates (cloneContainer relative) */ + globalToScroll(gx, gy, useTarget=false) { + // NB: must use this.cloneContainer.transform_stage_point(gx, gy) if stuff is not simply translated + let x = gx - this.monitor.x - (useTarget ? this.targetX : this.cloneContainer.x); + let y = gy - this.monitor.y - this.cloneContainer.y; + return [x, y]; + } + moveDone() { if (this.cloneContainer.x !== this.targetX || this.actor.y !== 0 ||