Remove Browser object

This commit is contained in:
Paulo Gustavo Veiga 2021-12-23 09:56:36 -08:00
parent c2189a31fa
commit 76dcadccd6
4 changed files with 5 additions and 13 deletions

View File

@ -9,8 +9,6 @@
"plugin:cypress/recommended" "plugin:cypress/recommended"
], ],
"globals": { "globals": {
// Browser is a mootools polyfill. Remove when moving from browser checks to feature detection
"Browser": true,
// designer is a global currently used as a hack. Remove this when fixing the hack. // designer is a global currently used as a hack. Remove this when fixing the hack.
"designer": true "designer": true
}, },

View File

@ -81,8 +81,8 @@ class DragTopic {
} }
updateFreeLayout(event) { updateFreeLayout(event) {
const isFreeEnabled = (event.metaKey && Browser.Platform.mac) const isMac = window.navigator.platform.toUpperCase().indexOf('MAC') >= 0;
|| (event.ctrlKey && !Browser.Platform.mac); const isFreeEnabled = (event.metaKey && isMac) || (event.ctrlKey && !isMac);
if (this.isFreeLayoutOn() !== isFreeEnabled) { if (this.isFreeLayoutOn() !== isFreeEnabled) {
const dragPivot = this._getDragPivot(); const dragPivot = this._getDragPivot();

View File

@ -640,13 +640,11 @@ class Topic extends NodeGraph {
const me = this; const me = this;
// Focus events ... // Focus events ...
elem.addEvent('mousedown', (event) => { elem.addEvent('mousedown', (event) => {
const isMac = window.navigator.platform.toUpperCase().indexOf('MAC') >= 0;
if (!me.isReadOnly()) { if (!me.isReadOnly()) {
// Disable topic selection of readOnly mode ... // Disable topic selection of readOnly mode ...
let value = true; let value = true;
if ( if ((event.metaKey && isMac) || (event.ctrlKey && !isMac)) {
(event.metaKey && Browser.Platform.mac)
|| (event.ctrlKey && !Browser.Platform.mac)
) {
value = !me.isOnFocus(); value = !me.isOnFocus();
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();

View File

@ -178,11 +178,7 @@ class Workspace {
workspace.setCoordOrigin(coordOriginX, coordOriginY); workspace.setCoordOrigin(coordOriginX, coordOriginY);
// Change cursor. // Change cursor.
if (Browser.firefox) {
window.document.body.style.cursor = '-moz-grabbing';
} else {
window.document.body.style.cursor = 'move'; window.document.body.style.cursor = 'move';
}
mouseMoveEvent.preventDefault(); mouseMoveEvent.preventDefault();
// Fire drag event ... // Fire drag event ...