-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: multilayered stencil mask issue (#10323)
* tweak stencil modes * add visual test * remove only.. again :D * remove unused vars --------- Co-authored-by: Zyie <24736175+Zyie@users.noreply.github.com>
- Loading branch information
1 parent
0e4a27a
commit 35481a1
Showing
6 changed files
with
50 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Container } from '../../../../src/scene/container/Container'; | ||
import { Graphics } from '../../../../src/scene/graphics/shared/Graphics'; | ||
|
||
import type { TestScene } from '../../types'; | ||
|
||
export const scene: TestScene = { | ||
it: 'should render masks if they have multiple layers correctly', | ||
create: async (scene: Container) => | ||
{ | ||
const wrapper = new Container(); | ||
|
||
const width = 128 - 20; | ||
const height = 128 - 20; | ||
const border = 4; | ||
const radius = 4; | ||
|
||
const bg = new Graphics() | ||
.roundRect(0, 0, width, height, radius + border) | ||
.fill(0xffffff) | ||
.roundRect(border, border, width - (border * 2), height - (border * 2), radius) | ||
.fill(0x0000ff); | ||
|
||
wrapper.x = 10; | ||
wrapper.y = 10; | ||
|
||
const mask = new Graphics() | ||
.roundRect(0, 0, width, height, radius + border) | ||
.fill(0xff0000) | ||
.roundRect(border, border, width - (border * 2), height - (border * 2), radius) | ||
.fill(0xffffff); | ||
|
||
const thingOutSideofMask = new Graphics() | ||
.rect(0, 0, 1000, 20) | ||
.fill(0x00ff00); | ||
|
||
// mask.y =100; | ||
wrapper.addChild(mask, bg, thingOutSideofMask); | ||
wrapper.mask = mask; | ||
|
||
scene.addChild(wrapper); | ||
}, | ||
}; |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.