Cleaned up browser support for full-screen and pointer-locking in the Video component, and reduced the default scale factor for mouse movement events from 1.0 to 0.5, since modern screens are generally much higher resolution

This commit is contained in:
Jeff Parsons 2017-08-02 10:37:45 -07:00 committed by Jeff Parsons
commit a3c252bf99
24 changed files with 4060 additions and 4000 deletions

View file

@ -100,12 +100,7 @@ class Usr {
*/
static getTimestamp()
{
var date = new Date();
var padNum = function(n)
{
return (n < 10 ? "0" : "") + n;
};
return date.getFullYear() + "-" + padNum(date.getMonth() + 1) + "-" + padNum(date.getDate()) + " " + padNum(date.getHours()) + ":" + padNum(date.getMinutes()) + ":" + padNum(date.getSeconds());
return Usr.formatDate("Y-m-d H:i:s");
}
/**

View file

@ -662,6 +662,45 @@ class Web {
return Web.isUserAgent("Mobi");
}
/**
* findProperty(obj, sProp, sSuffix)
*
* If both sProp and sSuffix are set, then any browser-specific prefixes are inserted between sProp and sSuffix,
* and if a match is found, it is returned without sProp.
*
* For example, if findProperty(document, 'on', 'fullscreenchange') discovers that 'onwebkitfullscreenchange' exists,
* it will return 'webkitfullscreenchange', in preparation for an addEventListener() call.
*
* More commonly, sSuffix is not used, so whatever property is found is returned as-is.
*
* @param {Object|null|undefined} obj
* @param {string} sProp
* @param {string} [sSuffix]
* @return {string|null}
*/
static findProperty(obj, sProp, sSuffix)
{
if (obj) {
for (var i = 0; i < Web.asBrowserPrefixes.length; i++) {
var sName = Web.asBrowserPrefixes[i];
if (sSuffix) {
sName += sSuffix;
var sEvent = sProp + sName;
if (sEvent in obj) return sName;
} else {
if (!sName) {
sName = sProp[0].toLowerCase();
} else {
sName += sProp[0].toUpperCase();
}
sName += sProp.substr(1);
if (sName in obj) return sName;
}
}
}
return null;
}
/**
* getURLParm(sParm)
*
@ -971,6 +1010,8 @@ Web.aPageEventHandlers = {
'exit': [] // list of window 'onunload' handlers (although we prefer to use 'onbeforeunload' if possible)
};
Web.asBrowserPrefixes = ['', 'moz', 'ms', 'webkit'];
Web.fPageLoaded = false; // set once the page's first 'onload' event has occurred
Web.fPageShowed = false; // set once the page's first 'onpageshow' event has occurred
Web.fPageEventsEnabled = true; // default is true, set to false (or true) by enablePageEvents()

View file

@ -933,7 +933,7 @@
<xsl:variable name="scaleMouse">
<xsl:choose>
<xsl:when test="@scaleMouse"><xsl:value-of select="@scaleMouse"/></xsl:when>
<xsl:otherwise>1</xsl:otherwise>
<xsl:otherwise>0.5</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:call-template name="component">