-
-
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.
Merge branch 'master' into reduce-setcoords-call
- Loading branch information
Showing
105 changed files
with
5,642 additions
and
2,289 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import * as fabric from 'fabric'; | ||
|
||
export async function testCase(canvas: fabric.Canvas) { | ||
const canvasImage = new fabric.StaticCanvas(undefined, { | ||
width: 200, | ||
height: 200, | ||
}); | ||
canvasImage.add( | ||
new fabric.Rect({ fill: 'red', width: 100, height: 100, top: 0, left: 0 }) | ||
); | ||
canvasImage.add( | ||
new fabric.Rect({ | ||
fill: 'blue', | ||
width: 100, | ||
height: 100, | ||
top: 0, | ||
left: 100, | ||
}) | ||
); | ||
canvasImage.add( | ||
new fabric.Rect({ | ||
fill: 'green', | ||
width: 100, | ||
height: 100, | ||
top: 100, | ||
left: 0, | ||
}) | ||
); | ||
canvasImage.add( | ||
new fabric.Rect({ | ||
fill: 'purple', | ||
width: 100, | ||
height: 100, | ||
top: 100, | ||
left: 100, | ||
}) | ||
); | ||
canvasImage.renderAll(); | ||
const image = new fabric.Image(canvasImage.lowerCanvasEl); | ||
image.filters = [ | ||
new fabric.filters.Noise({ noise: 0.2 }), | ||
new fabric.filters.Vibrance({ vibrance: 0.3 }), | ||
new fabric.filters.Vintage(), | ||
new fabric.filters.Grayscale(), | ||
]; | ||
image.applyFilters(); | ||
canvas.add(image); | ||
} |
69 changes: 69 additions & 0 deletions
69
.codesandbox/templates/vanilla/src/testcases/flippedInteractive.ts
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,69 @@ | ||
import * as fabric from 'fabric'; | ||
|
||
export function testCase(canvas: fabric.Canvas, objectCaching = true) { | ||
function renderNamedControl( | ||
this: fabric.Control, | ||
ctx: CanvasRenderingContext2D, | ||
left: number, | ||
top: number, | ||
styleOverride: any, | ||
fabricObject: fabric.FabricObject | ||
) { | ||
ctx.save(); | ||
ctx.font = '12px Arial'; | ||
ctx.fillStyle = 'black'; | ||
ctx.fillText(this.name || '??', left - 12, top - 3); | ||
ctx.restore(); | ||
} | ||
|
||
canvas.preserveObjectStacking = true; | ||
const rect = new fabric.Rect({ | ||
left: 100, | ||
top: 50, | ||
width: 100, | ||
height: 100, | ||
flipX: false, | ||
fill: 'blue', | ||
padding: 20, | ||
}); | ||
|
||
const controls = rect.controls; | ||
|
||
Object.entries(controls).forEach(([key, control]) => { | ||
control.name = key; | ||
control.render = renderNamedControl; | ||
}); | ||
|
||
const rect2 = new fabric.Rect({ | ||
top: 200, | ||
width: 50, | ||
height: 50, | ||
fill: 'red', | ||
flipX: true, | ||
opacity: 1, | ||
controls, | ||
padding: 20, | ||
}); | ||
|
||
const g = new fabric.Group([rect], { | ||
subTargetCheck: true, | ||
interactive: true, | ||
objectCaching, | ||
skewX: 0, | ||
angle: 90, | ||
flipY: true, | ||
controls, | ||
}); | ||
const g2 = new fabric.Group([rect2], { | ||
top: 100, | ||
left: 100, | ||
subTargetCheck: true, | ||
interactive: true, | ||
objectCaching, | ||
angle: 0, | ||
flipY: false, | ||
controls, | ||
}); | ||
canvas.add(g); | ||
canvas.add(g2); | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.