Merge pull request #4 from aha-app/issue-scale-lineWidth
Apply to scale to lineWidth.
This commit is contained in:
commit
67d5dfd52e
@ -433,6 +433,9 @@ export default (function () {
|
||||
//fill-opacity or stroke-opacity has already been set by stroke or fill.
|
||||
continue;
|
||||
}
|
||||
} else if (keys[i] === 'lineWidth') {
|
||||
var scale = this.__getTransformScale();
|
||||
value = value * Math.max(scale.x, scale.y);
|
||||
}
|
||||
//otherwise only update attribute if right type, and not svg default
|
||||
currentElement.setAttribute(attr, value);
|
||||
|
@ -11,6 +11,7 @@ import globalAlpha from './tests/globalalpha'
|
||||
import gradient from './tests/gradient'
|
||||
import linecap from './tests/linecap'
|
||||
import linewidth from './tests/linewidth'
|
||||
import scaledLine from './tests/scaledLine'
|
||||
import rgba from './tests/rgba'
|
||||
import rotate from './tests/rotate'
|
||||
import saveandrestore from './tests/saveandrestore'
|
||||
@ -34,6 +35,7 @@ const tests = [
|
||||
gradient,
|
||||
linecap,
|
||||
linewidth,
|
||||
scaledLine,
|
||||
rgba,
|
||||
rotate,
|
||||
saveandrestore,
|
||||
|
@ -12,6 +12,7 @@ import globalAlpha from './tests/globalalpha'
|
||||
import gradient from './tests/gradient'
|
||||
import linecap from './tests/linecap'
|
||||
import linewidth from './tests/linewidth'
|
||||
import scaledLine from './tests/scaledLine'
|
||||
import rgba from './tests/rgba'
|
||||
import rotate from './tests/rotate'
|
||||
import saveandrestore from './tests/saveandrestore'
|
||||
@ -35,6 +36,7 @@ const tests = {
|
||||
gradient,
|
||||
linecap,
|
||||
linewidth,
|
||||
scaledLine,
|
||||
rgba,
|
||||
rotate,
|
||||
saveandrestore,
|
||||
|
10
test/tests/scaledLine.js
Normal file
10
test/tests/scaledLine.js
Normal file
@ -0,0 +1,10 @@
|
||||
export default function scaledLine(ctx) {
|
||||
ctx.scale(1.5, 1.5);
|
||||
for (var i = 0; i < 10; i++){
|
||||
ctx.lineWidth = 1+i;
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(5+i*14,5);
|
||||
ctx.lineTo(5+i*14,140);
|
||||
ctx.stroke();
|
||||
}
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user