center grid overlay
This commit is contained in:
parent
19355033ff
commit
352f86018b
18
area.js
18
area.js
|
|
@ -277,18 +277,22 @@ var DrawingArea = new Lang.Class({
|
||||||
cr.save();
|
cr.save();
|
||||||
Clutter.cairo_set_source_color(cr, this.gridColor);
|
Clutter.cairo_set_source_color(cr, this.gridColor);
|
||||||
|
|
||||||
let [gridX, gridY] = [this.gridGap, this.gridGap];
|
let [gridX, gridY] = [0, 0];
|
||||||
while (gridX < this.monitor.width) {
|
while (gridX < this.monitor.width / 2) {
|
||||||
cr.setLineWidth((gridX / this.gridGap) % 5 ? this.gridInterlineWidth : this.gridLineWidth);
|
cr.setLineWidth((gridX / this.gridGap) % 5 ? this.gridInterlineWidth : this.gridLineWidth);
|
||||||
cr.moveTo(gridX, 0);
|
cr.moveTo(this.monitor.width / 2 + gridX, 0);
|
||||||
cr.lineTo(gridX, this.monitor.height);
|
cr.lineTo(this.monitor.width / 2 + gridX, this.monitor.height);
|
||||||
|
cr.moveTo(this.monitor.width / 2 - gridX, 0);
|
||||||
|
cr.lineTo(this.monitor.width / 2 - gridX, this.monitor.height);
|
||||||
gridX += this.gridGap;
|
gridX += this.gridGap;
|
||||||
cr.stroke();
|
cr.stroke();
|
||||||
}
|
}
|
||||||
while (gridY < this.monitor.height) {
|
while (gridY < this.monitor.height / 2) {
|
||||||
cr.setLineWidth((gridY / this.gridGap) % 5 ? this.gridInterlineWidth : this.gridLineWidth);
|
cr.setLineWidth((gridY / this.gridGap) % 5 ? this.gridInterlineWidth : this.gridLineWidth);
|
||||||
cr.moveTo(0, gridY);
|
cr.moveTo(0, this.monitor.height / 2 + gridY);
|
||||||
cr.lineTo(this.monitor.width, gridY);
|
cr.lineTo(this.monitor.width, this.monitor.height / 2 + gridY);
|
||||||
|
cr.moveTo(0, this.monitor.height / 2 - gridY);
|
||||||
|
cr.lineTo(this.monitor.width, this.monitor.height / 2 - gridY);
|
||||||
gridY += this.gridGap;
|
gridY += this.gridGap;
|
||||||
cr.stroke();
|
cr.stroke();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue