Merge pull request #67044 from winterpixelgames/3.x-bugfix-web-cursor

[3.x] Fix bug in setting custom cursor on web
This commit is contained in:
Fabio Alessandrelli 2022-10-08 12:31:52 +02:00 committed by GitHub
commit 3c39bc365f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -173,7 +173,7 @@ const GodotDisplayCursor = {
$GodotDisplayCursor__deps: ['$GodotOS', '$GodotConfig'],
$GodotDisplayCursor__postset: 'GodotOS.atexit(function(resolve, reject) { GodotDisplayCursor.clear(); resolve(); });',
$GodotDisplayCursor: {
shape: 'auto',
shape: 'default',
visible: true,
cursors: {},
set_style: function (style) {
@ -184,7 +184,7 @@ const GodotDisplayCursor = {
let css = shape;
if (shape in GodotDisplayCursor.cursors) {
const c = GodotDisplayCursor.cursors[shape];
css = `url("${c.url}") ${c.x} ${c.y}, auto`;
css = `url("${c.url}") ${c.x} ${c.y}, default`;
}
if (GodotDisplayCursor.visible) {
GodotDisplayCursor.set_style(css);
@ -192,7 +192,7 @@ const GodotDisplayCursor = {
},
clear: function () {
GodotDisplayCursor.set_style('');
GodotDisplayCursor.shape = 'auto';
GodotDisplayCursor.shape = 'default';
GodotDisplayCursor.visible = true;
Object.keys(GodotDisplayCursor.cursors).forEach(function (key) {
URL.revokeObjectURL(GodotDisplayCursor.cursors[key]);