update components
This commit is contained in:
parent
4b90291afc
commit
511d4882c1
3 changed files with 123 additions and 5 deletions
|
@ -14,12 +14,12 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
"devDependencies": {},
|
||||||
"ignore": [],
|
"ignore": [],
|
||||||
"version": "1.4.415",
|
"version": "1.4.417",
|
||||||
"_release": "1.4.415",
|
"_release": "1.4.417",
|
||||||
"_resolution": {
|
"_resolution": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"tag": "1.4.415",
|
"tag": "1.4.417",
|
||||||
"commit": "ef218c1a08315f961adbbc08515089198e885972"
|
"commit": "d03cd494c958c2fcbc45447fab8b6ab58c925cba"
|
||||||
},
|
},
|
||||||
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
|
"_source": "https://github.com/MediaBrowser/emby-webcomponents.git",
|
||||||
"_target": "^1.2.1",
|
"_target": "^1.2.1",
|
||||||
|
|
117
dashboard-ui/bower_components/emby-webcomponents/input/mouse.js
vendored
Normal file
117
dashboard-ui/bower_components/emby-webcomponents/input/mouse.js
vendored
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
define(['inputManager', 'focusManager', 'browser', 'layoutManager', 'events', 'dom'], function (inputmanager, focusManager, browser, layoutManager, events, dom) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var self = {};
|
||||||
|
|
||||||
|
var lastMouseInputTime = new Date().getTime();
|
||||||
|
var isMouseIdle;
|
||||||
|
|
||||||
|
function mouseIdleTime() {
|
||||||
|
return new Date().getTime() - lastMouseInputTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
function notifyApp() {
|
||||||
|
|
||||||
|
inputmanager.notifyMouseMove();
|
||||||
|
}
|
||||||
|
|
||||||
|
var lastMouseMoveData;
|
||||||
|
dom.addEventListener(document, 'mousemove', function (e) {
|
||||||
|
|
||||||
|
var eventX = e.screenX;
|
||||||
|
var eventY = e.screenY;
|
||||||
|
|
||||||
|
// if coord don't exist how could it move
|
||||||
|
if (typeof eventX === "undefined" && typeof eventY === "undefined") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var obj = lastMouseMoveData;
|
||||||
|
if (!obj) {
|
||||||
|
lastMouseMoveData = {
|
||||||
|
x: eventX,
|
||||||
|
y: eventY
|
||||||
|
};
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if coord are same, it didn't move
|
||||||
|
if (Math.abs(eventX - obj.x) < 10 && Math.abs(eventY - obj.y) < 10) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
obj.x = eventX;
|
||||||
|
obj.y = eventY;
|
||||||
|
|
||||||
|
lastMouseInputTime = new Date().getTime();
|
||||||
|
notifyApp();
|
||||||
|
|
||||||
|
if (isMouseIdle) {
|
||||||
|
isMouseIdle = false;
|
||||||
|
document.body.classList.remove('mouseIdle');
|
||||||
|
events.trigger(self, 'mouseactive');
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
passive: true
|
||||||
|
});
|
||||||
|
|
||||||
|
function onMouseEnter(e) {
|
||||||
|
|
||||||
|
var parent = focusManager.focusableParent(e.target);
|
||||||
|
if (parent) {
|
||||||
|
focusManager.focus(e.target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function enableFocusWithMouse() {
|
||||||
|
|
||||||
|
if (!layoutManager.tv) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (browser.xboxOne) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (browser.ps4) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (browser.tv) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function initMouseFocus() {
|
||||||
|
|
||||||
|
dom.removeEventListener(document, 'mouseenter', onMouseEnter, {
|
||||||
|
capture: true,
|
||||||
|
passive: true
|
||||||
|
});
|
||||||
|
|
||||||
|
if (enableFocusWithMouse()) {
|
||||||
|
dom.addEventListener(document, 'mouseenter', onMouseEnter, {
|
||||||
|
capture: true,
|
||||||
|
passive: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
initMouseFocus();
|
||||||
|
|
||||||
|
events.on(layoutManager, 'modechange', initMouseFocus);
|
||||||
|
|
||||||
|
setInterval(function () {
|
||||||
|
|
||||||
|
if (mouseIdleTime() >= 5000) {
|
||||||
|
isMouseIdle = true;
|
||||||
|
document.body.classList.add('mouseIdle');
|
||||||
|
events.trigger(self, 'mouseidle');
|
||||||
|
}
|
||||||
|
|
||||||
|
}, 5000);
|
||||||
|
|
||||||
|
return self;
|
||||||
|
});
|
|
@ -376,5 +376,6 @@
|
||||||
"SyncJobItemStatusFailed": "Failed",
|
"SyncJobItemStatusFailed": "Failed",
|
||||||
"SyncJobItemStatusRemovedFromDevice": "Removed from device",
|
"SyncJobItemStatusRemovedFromDevice": "Removed from device",
|
||||||
"SyncJobItemStatusCancelled": "Cancelled",
|
"SyncJobItemStatusCancelled": "Cancelled",
|
||||||
"Retry": "Retry"
|
"Retry": "Retry",
|
||||||
|
"MyDevice": "My device"
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue