Jump to content

How to make mousedown and mouseup work in a container.


Avatar
 Share

Recommended Posts

Pixi doesn't seem to call mousedown and mouseup when i click on an empty part of  a container in the example below. Am i doing anything wrong or is this a bug in Pixi? I'm using version 3.0.7.

<html><head><script src="libs/pixi.js"></script></head><body><script type="text/javascript">var renderer = PIXI.autoDetectRenderer(1000, 1000, { antialias: true, backgroundColor: 0x2F2312 });document.body.appendChild(renderer.view);// create the root of the scene graphvar stage = new PIXI.Container();stage.interactive = true;var graphics = new PIXI.Graphics();graphics.lineStyle(1, 0xFF00FF, 1);graphics.beginFill(0xFFFF0B, 0.5);graphics.drawCircle(140, 120,100);graphics.endFill();stage.addChild(graphics);stage.mousedown = function (moveData) {	console.log("mousedown");};stage.mousemove = function (moveData) {	console.log("mousemove");};stage.mouseup = function (moveDate) {	console.log("mouseup");};// run the render loopanimate();function animate() {    renderer.render(stage);    requestAnimationFrame( animate );}</script></body></html>
Link to comment
Share on other sites

  • 3 months later...
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...