From 495bc9b9308dc68edc93c2927ccb229fdf7487a4 Mon Sep 17 00:00:00 2001 From: Grzegorz Zachar Date: Fri, 3 Dec 2021 14:00:08 +0100 Subject: [PATCH 1/2] Added css cursor support. --- src/application/Application.mjs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/application/Application.mjs b/src/application/Application.mjs index ea4bbb0d..5100f6a2 100644 --- a/src/application/Application.mjs +++ b/src/application/Application.mjs @@ -67,6 +67,8 @@ export default class Application extends Component { this.stage.platform.registerScrollWheelHandler((e) => { this._recieveScrollWheel(e); }); + + this.cursor = 'default'; } } @@ -522,6 +524,9 @@ export default class Application extends Component { if (c["_handleUnhover"]) { c._handleUnhover(elem); } + if (elem.parent && elem.parent.cursor) { + this.stage.getCanvas().style.cursor = elem.parent.cursor; + } } } @@ -535,6 +540,12 @@ export default class Application extends Component { } } + // New element hover cursor + const lastElement = diffBranch[0]; + if (lastElement && lastElement.cursor) { + this.stage.getCanvas().style.cursor = lastElement.cursor; + } + // Rerun _handleHover for target element in case it's been hovered // back from its child if (diffBranch.length === 0 && target) { From 7aebaa4f1beb39aecc9a11a609c648f6057ee0b7 Mon Sep 17 00:00:00 2001 From: Grzegorz Zachar Date: Fri, 3 Dec 2021 14:10:52 +0100 Subject: [PATCH 2/2] Added example. --- examples/mouse-pointer/cursor.html | 67 ++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 examples/mouse-pointer/cursor.html diff --git a/examples/mouse-pointer/cursor.html b/examples/mouse-pointer/cursor.html new file mode 100644 index 00000000..28ee796a --- /dev/null +++ b/examples/mouse-pointer/cursor.html @@ -0,0 +1,67 @@ + + + + + + + + + + + +