diff --git a/src/interaction/InteractionManager.js b/src/interaction/InteractionManager.js index 19041f9..8fb9416 100644 --- a/src/interaction/InteractionManager.js +++ b/src/interaction/InteractionManager.js @@ -911,6 +911,12 @@ break; } } + else if (typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode)) + { + // if it mode is a string (not a Symbol) and cursorStyles doesn't have any entry + // for the mode, then assume that the dev wants it to be CSS for the cursor. + this.interactionDOMElement.style.cursor = mode; + } } /** diff --git a/src/interaction/InteractionManager.js b/src/interaction/InteractionManager.js index 19041f9..8fb9416 100644 --- a/src/interaction/InteractionManager.js +++ b/src/interaction/InteractionManager.js @@ -911,6 +911,12 @@ break; } } + else if (typeof mode === 'string' && !Object.prototype.hasOwnProperty.call(this.cursorStyles, mode)) + { + // if it mode is a string (not a Symbol) and cursorStyles doesn't have any entry + // for the mode, then assume that the dev wants it to be CSS for the cursor. + this.interactionDOMElement.style.cursor = mode; + } } /** diff --git a/test/interaction/InteractionManager.js b/test/interaction/InteractionManager.js index 56fe7af..68daaff 100644 --- a/test/interaction/InteractionManager.js +++ b/test/interaction/InteractionManager.js @@ -1194,7 +1194,7 @@ expect(pointer.renderer.view.style.display).to.equal('none'); }); - it('should not change cursor style if no cursor style provided', function () + it('should not change cursor style if null cursor style provided', function () { const stage = new PIXI.Container(); const graphics = new PIXI.Graphics(); @@ -1214,6 +1214,22 @@ pointer.mousemove(60, 60); expect(pointer.renderer.view.style.cursor).to.equal(''); }); + + it.only('should use cursor property as css if no style entry', function () + { + const stage = new PIXI.Container(); + const graphics = new PIXI.Graphics(); + const pointer = this.pointer = new MockPointer(stage); + + stage.addChild(graphics); + graphics.beginFill(0xFFFFFF); + graphics.drawRect(0, 0, 50, 50); + graphics.interactive = true; + graphics.cursor = 'text'; + + pointer.mousemove(10, 10); + expect(pointer.renderer.view.style.cursor).to.equal('text'); + }); }); describe('recursive hitTesting', function ()