pixi-react icon indicating copy to clipboard operation
pixi-react copied to clipboard

Bug: parent container's event is triggered twice.

Open mathedu4all opened this issue 2 years ago • 0 comments

Current Behavior

parent container's event is triggered twice.

Expected Behavior

parent container's event should be triggered once as child.

Steps to Reproduce

import { Container, createRoot, Graphics } from '@pixi/react'
import { Application, ICanvas } from 'pixi.js'
import React from 'react'
import * as PIXI from 'pixi.js'

const container = document.getElementById('container') as unknown as ICanvas
if (container) {
  const app = new Application({
    width: 1080,
    height: 1920,
    view: container,
    antialias: true,
    backgroundColor: 0xf0e1d8
  })
  const root = createRoot(app.stage)
  const draw = (g: PIXI.Graphics) => {
    g.beginFill(0x000000)
    g.drawRect(0, 0, 100, 100)
    g.endFill()
  }
  root.render(
    <Container eventMode={'static'} onpointerdown={() => console.log('down')}>
      <Container eventMode={'static'} onpointerup={() => console.log('up')}>
        <Graphics draw={draw} />
      </Container>
    </Container>
  )
}

Environment

  • @pixi/react version: 7.0.3
  • pixi.js version: 7.2.1
  • React version: 18.2.0
  • ReactDOM version: 18.2.0

Possible Solution

No response

Additional Information

No response

mathedu4all avatar Mar 21 '23 11:03 mathedu4all