ctx.fill();
break;
case 'rect':
- ctx.fillRect(vm.x - radius, vm.y - radius, 2 * radius, 2 * radius);
- ctx.strokeRect(vm.x - radius, vm.y - radius, 2 * radius, 2 * radius);
+ ctx.fillRect(vm.x - 1 / Math.SQRT2 * radius, vm.y - 1 / Math.SQRT2 * radius, 2 / Math.SQRT2 * radius, 2 / Math.SQRT2 * radius);
+ ctx.strokeRect(vm.x - 1 / Math.SQRT2 * radius, vm.y - 1 / Math.SQRT2 * radius, 2 / Math.SQRT2 * radius, 2 / Math.SQRT2 * radius);
break;
case 'rectRot':
ctx.translate(vm.x, vm.y);
ctx.rotate(Math.PI / 4);
- ctx.fillRect(-radius, -radius, 2 * radius, 2 * radius);
- ctx.strokeRect(-radius, -radius, 2 * radius, 2 * radius);
+ ctx.fillRect(-1 / Math.SQRT2 * radius, -1 / Math.SQRT2 * radius, 2 / Math.SQRT2 * radius, 2 / Math.SQRT2 * radius);
+ ctx.strokeRect(-1 / Math.SQRT2 * radius, -1 / Math.SQRT2 * radius, 2 / Math.SQRT2 * radius, 2 / Math.SQRT2 * radius);
ctx.setTransform(1, 0, 0, 1, 0, 0);
break;
case 'cross':
args: ['rgba(0, 255, 0)']
}, {
name: 'fillRect',
- args: [8, 13, 4, 4]
+ args: [10 - 1 / Math.SQRT2 * 2, 15 - 1 / Math.SQRT2 * 2, 2 / Math.SQRT2 * 2, 2 / Math.SQRT2 * 2]
}, {
name: 'strokeRect',
- args: [8, 13, 4, 4]
+ args: [10 - 1 / Math.SQRT2 * 2, 15 - 1 / Math.SQRT2 * 2, 2 / Math.SQRT2 * 2, 2 / Math.SQRT2 * 2]
}, {
name: 'stroke',
args: []
args: [Math.PI / 4]
}, {
name: 'fillRect',
- args: [-2, -2, 4, 4],
+ args: [-1 / Math.SQRT2 * 2, -1 / Math.SQRT2 * 2, 2 / Math.SQRT2 * 2, 2 / Math.SQRT2 * 2],
}, {
name: 'strokeRect',
- args: [-2, -2, 4, 4],
+ args: [-1 / Math.SQRT2 * 2, -1 / Math.SQRT2 * 2, 2 / Math.SQRT2 * 2, 2 / Math.SQRT2 * 2],
}, {
name: 'setTransform',
args: [1, 0, 0, 1, 0, 0],