Replace unnecessary function supportsCursorURIs by a constant variable
This commit is contained in:
parent
44f4c5545f
commit
41ddb35458
|
@ -25,30 +25,24 @@ window.addEventListener('touchstart', function onFirstTouch() {
|
||||||
// brings us a bit closer but is not optimal.
|
// brings us a bit closer but is not optimal.
|
||||||
export let dragThreshold = 10 * (window.devicePixelRatio || 1);
|
export let dragThreshold = 10 * (window.devicePixelRatio || 1);
|
||||||
|
|
||||||
let _cursor_uris_supported = null;
|
let _supportsCursorURIs = false;
|
||||||
|
|
||||||
export function supportsCursorURIs() {
|
try {
|
||||||
if (_cursor_uris_supported === null) {
|
const target = document.createElement('canvas');
|
||||||
try {
|
target.style.cursor = 'url("data:image/x-icon;base64,AAACAAEACAgAAAIAAgA4AQAAFgAAACgAAAAIAAAAEAAAAAEAIAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAA==") 2 2, default';
|
||||||
const target = document.createElement('canvas');
|
|
||||||
target.style.cursor = 'url("data:image/x-icon;base64,AAACAAEACAgAAAIAAgA4AQAAFgAAACgAAAAIAAAAEAAAAAEAIAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////AAAAAAAAAAAAAAAAAAAAAA==") 2 2, default';
|
|
||||||
|
|
||||||
if (target.style.cursor) {
|
if (target.style.cursor) {
|
||||||
Log.Info("Data URI scheme cursor supported");
|
Log.Info("Data URI scheme cursor supported");
|
||||||
_cursor_uris_supported = true;
|
_supportsCursorURIs = true;
|
||||||
} else {
|
} else {
|
||||||
Log.Warn("Data URI scheme cursor not supported");
|
Log.Warn("Data URI scheme cursor not supported");
|
||||||
_cursor_uris_supported = false;
|
|
||||||
}
|
|
||||||
} catch (exc) {
|
|
||||||
Log.Error("Data URI scheme cursor test exception: " + exc);
|
|
||||||
_cursor_uris_supported = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} catch (exc) {
|
||||||
return _cursor_uris_supported;
|
Log.Error("Data URI scheme cursor test exception: " + exc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const supportsCursorURIs = _supportsCursorURIs;
|
||||||
|
|
||||||
let _supportsImageMetadata = false;
|
let _supportsImageMetadata = false;
|
||||||
try {
|
try {
|
||||||
new ImageData(new Uint8ClampedArray(4), 1, 1);
|
new ImageData(new Uint8ClampedArray(4), 1, 1);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
import { supportsCursorURIs, isTouchDevice } from './browser.js';
|
import { supportsCursorURIs, isTouchDevice } from './browser.js';
|
||||||
|
|
||||||
const useFallback = !supportsCursorURIs() || isTouchDevice;
|
const useFallback = !supportsCursorURIs || isTouchDevice;
|
||||||
|
|
||||||
export default class Cursor {
|
export default class Cursor {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
Loading…
Reference in New Issue