this._events();
}
- /**
- * Grabs the current positioning class, if present, and returns the value or an empty string.
- * @private
- */
- _getPositionClass(element) {
- if (!element) { return ''; }
-
- var elementClassName = element[0].className;
- if (element[0] instanceof SVGElement) {
+ _getDefaultPosition() {
+ // handle legacy classnames
+ var position = this.$element[0].className.match(/\b(top|left|right|bottom)\b/g);
++ var elementClassName = this.$element[0].className;
++ if (this.$element[0] instanceof SVGElement) {
+ elementClassName = elementClassName.baseVal;
+ }
-
+ return position ? position[0] : 'top';
+ var position = elementClassName.match(/\b(top|left|right)\b/g);
- position = position ? position[0] : '';
- return position;
- };
++ position = position ? position[0] : 'tp';
+ }
+
+ _getDefaultAlignment() {
+ return 'center';
+ }
+
+ _getHOffset() {
+ if(this.position === 'left' || this.position === 'right') {
+ return this.options.hOffset + this.options.tooltipWidth;
+ } else {
+ return this.options.hOffset
+ }
+ }
+
+ _getVOffset() {
+ if(this.position === 'top' || this.position === 'bottom') {
+ return this.options.vOffset + this.options.tooltipHeight;
+ } else {
+ return this.options.vOffset
+ }
+ }
+
/**
* builds the tooltip element, adds attributes, and returns the template.
* @private