Merge pull request #1912 from mathiask88/pointStyleFix

Fixes the point size for rect and rectRot
This commit is contained in:
Evert Timberg 2016-01-18 15:55:06 -05:00
commit 62988e9768
2 changed files with 8 additions and 8 deletions

View File

@ -96,14 +96,14 @@
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':

View File

@ -166,10 +166,10 @@ describe('Point element tests', function() {
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: []
@ -196,10 +196,10 @@ describe('Point element tests', function() {
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],