|
@@ -104,30 +104,36 @@ export default class Draw {
|
|
|
this.context.restore();
|
|
|
}
|
|
|
|
|
|
- drawGrid(w, h, step1, step2) {
|
|
|
+ drawGrid(startX, startY, w, h, step1, step2) {
|
|
|
+ this.context.save();
|
|
|
this.context.beginPath();
|
|
|
- for (var x = 0; x <= w; x += step1) {
|
|
|
- if (x % step2 == 0) {
|
|
|
- this.context.strokeStyle = "rgba(0,0,0,0.8)";
|
|
|
- } else {
|
|
|
- this.context.strokeStyle = "rgba(0,0,0,0.2)";
|
|
|
- }
|
|
|
+ for (var x = startX; x <= w; x += step1) {
|
|
|
this.context.moveTo(x, 0);
|
|
|
this.context.lineTo(x, h);
|
|
|
}
|
|
|
|
|
|
- for (var y = 0; y <= h; y += step1) {
|
|
|
- if (x % step2 == 0) {
|
|
|
- this.context.strokeStyle = "rgba(0,0,0,0.8)";
|
|
|
- } else {
|
|
|
- this.context.strokeStyle = "rgba(0,0,0,0.2)";
|
|
|
- }
|
|
|
+ for (var y = startY; y <= h; y += step1) {
|
|
|
this.context.moveTo(0, y);
|
|
|
this.context.lineTo(w, y);
|
|
|
}
|
|
|
+ this.context.strokeStyle = "rgba(0,0,0,0.1)";
|
|
|
+ this.context.lineWidth = 0.5;
|
|
|
+ this.context.stroke();
|
|
|
|
|
|
+ this.context.beginPath();
|
|
|
+ for (var x = startX; x <= w; x += step2) {
|
|
|
+ this.context.moveTo(x, 0);
|
|
|
+ this.context.lineTo(x, h);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (var y = startY; y <= h; y += step2) {
|
|
|
+ this.context.moveTo(0, y);
|
|
|
+ this.context.lineTo(w, y);
|
|
|
+ }
|
|
|
+ this.context.strokeStyle = "rgba(0,0,0,0.2)";
|
|
|
this.context.lineWidth = 1;
|
|
|
this.context.stroke();
|
|
|
+ this.context.restore();
|
|
|
}
|
|
|
|
|
|
drawRoad(vector, isTemp) {
|