-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix target display object when destroying mediator. #7
- Loading branch information
Showing
6 changed files
with
52 additions
and
10 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,23 @@ | ||
import { inject } from "robotlegs"; | ||
import { ChildView } from "./ChildView" | ||
import { Mediator } from "../../src/index"; | ||
|
||
export class ChildMediator extends Mediator<ChildView> { | ||
|
||
initialize() | ||
{ | ||
console.log("ChildMediator initialized!"); | ||
this.view.interactive = true; | ||
this.addViewListener("click", this.onClick, this); | ||
} | ||
|
||
onClick (e) { | ||
this.view.parent.removeChild(this.view); | ||
} | ||
|
||
destroy () { | ||
console.log("ChildMediator destroyed!"); | ||
} | ||
|
||
} | ||
|
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,15 @@ | ||
import { Container, Graphics } from "pixi.js"; | ||
|
||
export class ChildView extends Container { | ||
|
||
constructor () { | ||
super(); | ||
|
||
let g = new Graphics(); | ||
g.beginFill(0xff00ff); | ||
g.drawCircle(Math.random() * 800, Math.random() * 600, 50); | ||
|
||
this.addChild(g); | ||
} | ||
|
||
} |
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