MCPcopy
hub / github.com/tdewolff/minify / TooltipHTMLContent

Function TooltipHTMLContent

_benchmarks/sample_echarts.js:80280–80348  ·  view source on GitHub ↗
(container, api, opt)

Source from the content-addressed store, hash-verified

80278 /** @class */
80279 function () {
80280 function TooltipHTMLContent(container, api, opt) {
80281 this._show = false;
80282 this._styleCoord = [0, 0, 0, 0];
80283 this._enterable = true;
80284 this._firstShow = true;
80285 this._longHide = true;
80286
80287 if (env.wxa) {
80288 return null;
80289 }
80290
80291 var el = document.createElement('div'); // TODO: TYPE
80292
80293 el.domBelongToZr = true;
80294 this.el = el;
80295 var zr = this._zr = api.getZr();
80296 var appendToBody = this._appendToBody = opt && opt.appendToBody;
80297 makeStyleCoord(this._styleCoord, zr, appendToBody, api.getWidth() / 2, api.getHeight() / 2);
80298
80299 if (appendToBody) {
80300 document.body.appendChild(el);
80301 } else {
80302 container.appendChild(el);
80303 }
80304
80305 this._container = container; // FIXME
80306 // Is it needed to trigger zr event manually if
80307 // the browser do not support `pointer-events: none`.
80308
80309 var self = this;
80310
80311 el.onmouseenter = function () {
80312 // clear the timeout in hideLater and keep showing tooltip
80313 if (self._enterable) {
80314 clearTimeout(self._hideTimeout);
80315 self._show = true;
80316 }
80317
80318 self._inContent = true;
80319 };
80320
80321 el.onmousemove = function (e) {
80322 e = e || window.event;
80323
80324 if (!self._enterable) {
80325 // `pointer-events: none` is set to tooltip content div
80326 // if `enterable` is set as `false`, and `el.onmousemove`
80327 // can not be triggered. But in browser that do not
80328 // support `pointer-events`, we need to do this:
80329 // Try trigger zrender event to avoid mouse
80330 // in and out shape too frequently
80331 var handler = zr.handler;
80332 var zrViewportRoot = zr.painter.getViewportRoot();
80333 normalizeEvent(zrViewportRoot, e, true);
80334 handler.dispatch('mousemove', e);
80335 }
80336 };
80337

Callers

nothing calls this directly

Calls 2

makeStyleCoordFunction · 0.85
normalizeEventFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…