Space.globalToSpace coordinate transform util

This commit is contained in:
Ole Jørgen Brønner
2020-01-17 17:14:36 +01:00
committed by Tor Hedin Brønner
parent ce969e77f3
commit a48dd56bf0
+8
View File
@@ -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 ||