File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
engine/modules/tooltip/src/main/resources/view/tooltip-module Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,16 @@ import { api as entityModule } from '../entity-module/GraphicEntityModule.js'
33
44/* global PIXI */
55
6+ function getSpriteMouseMoveFunc ( entity , tooltip ) {
7+ return function ( event ) {
8+ if ( entity . graphics . containsPoint ( event . data . global ) ) {
9+ tooltip . inside [ entity . id ] = true
10+ } else {
11+ delete tooltip . inside [ entity . id ]
12+ }
13+ }
14+ }
15+
616function getMouseOverFunc ( id , tooltip ) {
717 return function ( ) {
818 tooltip . inside [ id ] = true
@@ -136,8 +146,12 @@ export class TooltipModule {
136146 entityModule . entities . forEach ( entity => {
137147 if ( this . interactive [ entity . id ] ) {
138148 entity . container . interactive = true
139- entity . container . mouseover = getMouseOverFunc ( entity . id , this . tooltip )
140- entity . container . mouseout = getMouseOutFunc ( entity . id , this . tooltip )
149+ if ( typeof ( entity . graphics && entity . graphics . containsPoint ) === 'function' ) {
150+ entity . container . mousemove = getSpriteMouseMoveFunc ( entity , this . tooltip )
151+ } else {
152+ entity . container . mouseover = getMouseOverFunc ( entity . id , this . tooltip )
153+ entity . container . mouseout = getMouseOutFunc ( entity . id , this . tooltip )
154+ }
141155 }
142156 } )
143157 this . container = container
You can’t perform that action at this time.
0 commit comments