-
-
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.
fix(Activeselection): Activeselection default initialization (#9940)
- Loading branch information
Showing
4 changed files
with
44 additions
and
14 deletions.
There are no files selected for viewing
27 changes: 18 additions & 9 deletions
27
.codesandbox/templates/vanilla/src/testcases/clearCache.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 |
---|---|---|
@@ -1,14 +1,23 @@ | ||
import * as fabric from 'fabric'; | ||
|
||
export async function testCase(canvas: fabric.Canvas) { | ||
const utahCommonDefaults = { | ||
originX: 'center' as const, | ||
originY: 'center' as const, | ||
}; | ||
|
||
fabric.ActiveSelection.ownDefaults = { | ||
...fabric.ActiveSelection.ownDefaults, | ||
...utahCommonDefaults, | ||
}; | ||
|
||
fabric.Rect.ownDefaults = { | ||
...fabric.Rect.ownDefaults, | ||
...utahCommonDefaults, | ||
}; | ||
|
||
const rect = new fabric.Rect({ width: 500, height: 500, fill: 'blue' }); | ||
rect.on('moving', function (opt) { | ||
if (this.fill === 'blue') { | ||
this.fill = 'red'; | ||
} else { | ||
this.fill = 'blue'; | ||
} | ||
this.dirty = true; | ||
}); | ||
canvas.add(rect); | ||
const rect2 = new fabric.Rect({ width: 500, height: 500, fill: 'blue' }); | ||
|
||
canvas.add(rect, rect2); | ||
} |
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