tooltip delay of 500ms

This commit is contained in:
Thijs Wenker 2018-10-19 16:32:38 +02:00
parent a3b874f9aa
commit 358b0b76d1
2 changed files with 44 additions and 34 deletions

View file

@ -294,7 +294,7 @@
"tooltip": "The global dimensions of this entity."
},
"scale": {
"tooltip": "The global scaling of this entity,",
"tooltip": "The global scaling of this entity.",
"skipJSProperty": true
},
"registrationPoint": {

View file

@ -7,17 +7,25 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
const CREATE_APP_TOOLTIP_OFFSET = 20;
const TOOLTIP_DELAY = 500; // ms
function CreateAppTooltip() {
this._tooltipData = null;
this._tooltipDiv = null;
this._delayTimeout = null;
}
CreateAppTooltip.prototype = {
_tooltipData: null,
_tooltipDiv: null,
_delayTimeout: null,
_removeTooltipIfExists: function() {
if (this._delayTimeout !== null) {
window.clearTimeout(this._delayTimeout);
this._delayTimeout = null;
}
if (this._tooltipDiv !== null) {
this._tooltipDiv.remove();
this._tooltipDiv = null;
@ -33,6 +41,7 @@ CreateAppTooltip.prototype = {
this._removeTooltipIfExists();
this._delayTimeout = window.setTimeout(function() {
let tooltipData = this._tooltipData[tooltipID];
if (!tooltipData || tooltipData.tooltip === "") {
@ -76,6 +85,7 @@ CreateAppTooltip.prototype = {
elTip.style.left = window.pageXOffset + elementRect.left;
this._tooltipDiv = elTip;
}.bind(this), TOOLTIP_DELAY);
}.bind(this), false);
element.addEventListener("mouseout", function() {
this._removeTooltipIfExists();