import {Decorators} from '../decorator/factory'; import Renderer from './renderer';
/** * Implements a Tooltip. * * This component creates a tooltip containing a set of messages. * * @extends {Renderer}
*/
export defaultclass Tooltip extends Renderer {
/** * Base constructor * * @typedef {Object} options * @property {String} options.appendTo - where the generated html/svg components will be attached to, default body * @property {Function} options.callbackHandler - this handler will be used to invoke actions from the menu, default console.log * @property {Object} context - the context of the application, usually a configuration and a rendering manager instance
*/
constructor({appendTo, callbackHandler}, context) { super({appendTo: appendTo, callbackHandler: callbackHandler}, context);
}
/** * This method is used to render this component * * @public
*/
@Decorators.Data.requires('messages')
async render(e) {
this.element = this.HTMLParent.select('div.francy-tooltip-holder'); // check if the window is already present if (!this.element.node()) { this.element = this.HTMLParent.append('div')
.attr('class', 'francy-tooltip-holder');
}
// check if it exists already if (this.element.selectAll('*').node()) return;
let position = this.getMousePosition(e);
// TODO this won't be visible all the times, fine until someone complains about :P this.element.style('left', (position[0] + 15) + 'px').style('top', (position[1] - 15) + 'px');
let table = this.element.append('div').attr('class', 'francy-tooltip')
.append('div').attr('class', 'francy-table')
.append('div').attr('class', 'francy-table-body');
// destroy me after default delay this.autoUnrender();
returnthis;
}
/** * This method is used to destroy this component * * @public
*/
unrender() { if (this.element) { this.element.selectAll('*').remove(); this.element.style('display', null);
}
}
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.