|
@@ -42,10 +42,10 @@ class ScaleGrid extends h2d.TileGroup {
|
|
|
var bw = borderWidth, bh = borderHeight;
|
|
|
|
|
|
// 4 corners
|
|
|
- content.add(0, 0, tile.sub(0, 0, bw, bh));
|
|
|
- content.add(width - bw, 0, tile.sub(tile.width - bw, 0, bw, bh));
|
|
|
- content.add(0, height-bh, tile.sub(0, tile.height - bh, bw, bh));
|
|
|
- content.add(width - bw, height - bh, tile.sub(tile.width - bw, tile.height - bh, bw, bh));
|
|
|
+ content.addColor(0, 0, curColor, tile.sub(0, 0, bw, bh));
|
|
|
+ content.addColor(width - bw, 0, curColor, tile.sub(tile.width - bw, 0, bw, bh));
|
|
|
+ content.addColor(0, height-bh, curColor, tile.sub(0, tile.height - bh, bw, bh));
|
|
|
+ content.addColor(width - bw, height - bh, curColor, tile.sub(tile.width - bw, tile.height - bh, bw, bh));
|
|
|
|
|
|
var sizeX = tile.width - bw * 2;
|
|
|
var sizeY = tile.height - bh * 2;
|
|
@@ -57,48 +57,48 @@ class ScaleGrid extends h2d.TileGroup {
|
|
|
|
|
|
var t = tile.sub(bw, 0, sizeX, bh);
|
|
|
t.scaleToSize(w, bh);
|
|
|
- content.add(bw, 0, t);
|
|
|
+ content.addColor(bw, 0, curColor, t);
|
|
|
|
|
|
var t = tile.sub(bw, tile.height - bh, sizeX, bh);
|
|
|
t.scaleToSize(w, bh);
|
|
|
- content.add(bw, h + bh, t);
|
|
|
+ content.addColor(bw, h + bh, curColor, t);
|
|
|
|
|
|
var t = tile.sub(0, bh, bw, sizeY);
|
|
|
t.scaleToSize(bw, h);
|
|
|
- content.add(0, bh, t);
|
|
|
+ content.addColor(0, bh, curColor, t);
|
|
|
|
|
|
var t = tile.sub(tile.width - bw, bh, bw, sizeY);
|
|
|
t.scaleToSize(bw, h);
|
|
|
- content.add(w + bw, bh, t);
|
|
|
+ content.addColor(w + bw, bh, curColor, t);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
var rw = Std.int((width - bw * 2) / sizeX);
|
|
|
for( x in 0...rw ) {
|
|
|
- content.add(bw + x * sizeX, 0, tile.sub(bw, 0, sizeX, bh));
|
|
|
- content.add(bw + x * sizeX, height - bh, tile.sub(bw, tile.height - bh, sizeX, bh));
|
|
|
+ content.addColor(bw + x * sizeX, 0, curColor, tile.sub(bw, 0, sizeX, bh));
|
|
|
+ content.addColor(bw + x * sizeX, height - bh, curColor, tile.sub(bw, tile.height - bh, sizeX, bh));
|
|
|
}
|
|
|
var dx = width - bw * 2 - rw * sizeX;
|
|
|
if( dx > 0 ) {
|
|
|
- content.add(bw + rw * sizeX, 0, tile.sub(bw, 0, dx, bh));
|
|
|
- content.add(bw + rw * sizeX, height - bh, tile.sub(bw, tile.height - bh, dx, bh));
|
|
|
+ content.addColor(bw + rw * sizeX, 0, curColor, tile.sub(bw, 0, dx, bh));
|
|
|
+ content.addColor(bw + rw * sizeX, height - bh, curColor, tile.sub(bw, tile.height - bh, dx, bh));
|
|
|
}
|
|
|
|
|
|
var rh = Std.int((height - bh * 2) / sizeY);
|
|
|
for( y in 0...rh ) {
|
|
|
- content.add(0, bh + y * sizeY, tile.sub(0, bh, bw, sizeY));
|
|
|
- content.add(width - bw, bh + y * sizeY, tile.sub(tile.width - bw, bh, bw, sizeY));
|
|
|
+ content.addColor(0, bh + y * sizeY, curColor, tile.sub(0, bh, bw, sizeY));
|
|
|
+ content.addColor(width - bw, bh + y * sizeY, curColor, tile.sub(tile.width - bw, bh, bw, sizeY));
|
|
|
}
|
|
|
var dy = height - bh * 2 - rh * sizeY;
|
|
|
if( dy > 0 ) {
|
|
|
- content.add(0, bh + rh * sizeY, tile.sub(0, bh, bw, dy));
|
|
|
- content.add(width - bw, bh + rh * sizeY, tile.sub(tile.width - bw, bh, bw, dy));
|
|
|
+ content.addColor(0, bh + rh * sizeY, curColor, tile.sub(0, bh, bw, dy));
|
|
|
+ content.addColor(width - bw, bh + rh * sizeY, curColor, tile.sub(tile.width - bw, bh, bw, dy));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var t = tile.sub(bw, bh, sizeX, sizeY);
|
|
|
t.scaleToSize(width - bw * 2,height - bh * 2);
|
|
|
- content.add(bw, bh, t);
|
|
|
+ content.addColor(bw, bh, curColor, t);
|
|
|
}
|
|
|
super.draw(ctx);
|
|
|
}
|