-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refinements to strokeUniform property (#5527)
* new Object property strokeUniform allows the stroke width to always stay the same width as object scales * fix for height * Update src/shapes/object.class.js Co-Authored-By: stefanhayden <[email protected]> * trying the other function * different transformed function * added a visual test * fixed title * test svg * import value from svg * add svg import test * more tests
- Loading branch information
Showing
11 changed files
with
113 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
(function() { | ||
if (fabric.isLikelyNode) { | ||
if (process.env.launcher === 'Firefox') { | ||
fabric.browserShadowBlurConstant = 0.9; | ||
} | ||
if (process.env.launcher === 'Node') { | ||
fabric.browserShadowBlurConstant = 1; | ||
} | ||
if (process.env.launcher === 'Chrome') { | ||
fabric.browserShadowBlurConstant = 1.5; | ||
} | ||
if (process.env.launcher === 'Edge') { | ||
fabric.browserShadowBlurConstant = 1.75; | ||
} | ||
} | ||
else { | ||
if (navigator.userAgent.indexOf('Firefox') !== -1) { | ||
fabric.browserShadowBlurConstant = 0.9; | ||
} | ||
if (navigator.userAgent.indexOf('Chrome') !== -1) { | ||
fabric.browserShadowBlurConstant = 1.5; | ||
} | ||
if (navigator.userAgent.indexOf('Edge') !== -1) { | ||
fabric.browserShadowBlurConstant = 1.75; | ||
} | ||
} | ||
fabric.enableGLFiltering = false; | ||
fabric.isWebglSupported = false; | ||
fabric.Object.prototype.objectCaching = true; | ||
var visualTestLoop; | ||
if (fabric.isLikelyNode) { | ||
visualTestLoop = global.visualTestLoop; | ||
} | ||
else { | ||
visualTestLoop = window.visualTestLoop; | ||
} | ||
var fabricCanvas = this.canvas = new fabric.Canvas(null, { | ||
enableRetinaScaling: false, renderOnAddRemove: false, width: 200, height: 200, | ||
}); | ||
|
||
var tests = []; | ||
|
||
function generic1(canvas, callback) { | ||
canvas.setDimensions({ width: 150, height: 60 }); | ||
var rect = new fabric.Rect({ | ||
width: 20, height: 40, strokeWidth: 2, scaleX: 6, scaleY: 0.5, strokeUniform: true, | ||
fill: '', stroke: 'red' | ||
}); | ||
var rect2 = new fabric.Rect({ | ||
width: 60, height: 60, top: 4, left: 4, strokeWidth: 2, scaleX: 2, | ||
scaleY: 0.5, strokeUniform: false, fill: '', stroke: 'blue', | ||
}); | ||
canvas.add(rect); | ||
canvas.add(rect2); | ||
canvas.renderAll(); | ||
callback(canvas.lowerCanvasEl); | ||
} | ||
|
||
tests.push({ | ||
test: 'Rect with strokeUniform: true', | ||
code: generic1, | ||
golden: 'generic1.png', | ||
newModule: 'Generic rendering', | ||
percentage: 0.09, | ||
}); | ||
|
||
tests.forEach(visualTestLoop(fabricCanvas, QUnit)); | ||
})(); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,7 @@ | |
'clippath-6', | ||
'clippath-7', | ||
'clippath-9', | ||
'vector-effect' | ||
//'clippath-8', | ||
].map(createTestFromSVG); | ||
|
||
|