addon/utils/tip.js
function (node, data, event) {
    var point = data.position || (node.getScreenCTM ? _svgPoint.matrixTransform(
          node.getScreenCTM()
        ) : {
          x: event.x,
          y: event.y
        }),

        windMid = _window.height() >> 1,
        winWidth = _window.width(),

        showAbove = point.y < windMid,
        offsetX = 0,
        width = 0;

    if(_data !== data) {
      _data = data;
      _node = node;

      _setData(data);
    }

    if(showAbove) {
      _element.removeClass('below');
      _element.addClass('above');
    }
    else {
      _element.removeClass('above');
      _element.addClass('below');

      point.y -= _element.height();
    }

    width = _element.width();
    offsetX = (width - 11) >> 1;

    if(point.x - offsetX < 0) {
      offsetX = point.x - 20;
    }
    else if(point.x + offsetX > winWidth) {
      offsetX = point.x - (winWidth - 10 - width);
    }

    _bubble.css({
      left: -offsetX
    });

    Ember.run.debounce(Tip, "showTip", 500);

    _element.css({
      left: point.x,
      top: point.y
    });
  }
function (node, data, event) {
    var point = data.position || (node.getScreenCTM ? _svgPoint.matrixTransform(
          node.getScreenCTM()
        ) : {
          x: event.x,
          y: event.y
        }),

        windMid = _window.height() >> 1,
        winWidth = _window.width(),

        showAbove = point.y < windMid,
        offsetX = 0,
        width = 0;

    if(_data !== data) {
      _data = data;
      _node = node;

      _setData(data);
    }

    if(showAbove) {
      _element.removeClass('below');
      _element.addClass('above');
    }
    else {
      _element.removeClass('above');
      _element.addClass('below');

      point.y -= _element.height();
    }

    width = _element.width();
    offsetX = (width - 11) >> 1;

    if(point.x - offsetX < 0) {
      offsetX = point.x - 20;
    }
    else if(point.x + offsetX > winWidth) {
      offsetX = point.x - (winWidth - 10 - width);
    }

    _bubble.css({
      left: -offsetX
    });

    Ember.run.debounce(Tip, "showTip", 500);

    _element.css({
      left: point.x,
      top: point.y
    });
  }
function ( node , data , event ) { var point = data . position || ( node . getScreenCTM ? _svgPoint . matrixTransform ( node . getScreenCTM ( ) ) : { x : event . x , y : event . y } ) , windMid = _window . height ( ) >> 1 , winWidth = _window . width ( ) , showAbove = point . y < windMid , offsetX = 0 , width = 0 ; if ( _data !== data ) { _data = data ; _node = node ; _setData ( data ) ; } if ( showAbove ) { _element . removeClass ( 'below' ) ; _element . addClass ( 'above' ) ; } else { _element . removeClass ( 'above' ) ; _element . addClass ( 'below' ) ; point . y -= _element . height ( ) ; } width = _element . width ( ) ; offsetX = ( width - 11 ) >> 1 ; if ( point . x - offsetX < 0 ) { offsetX = point . x - 20 ; } else if ( point . x + offsetX > winWidth ) { offsetX = point . x - ( winWidth - 10 - width ) ; } _bubble . css ( { left : - offsetX } ) ; Ember . run . debounce ( Tip , "showTip" , 500 ) ; _element . css ( { left : point . x , top : point . y } ) ; }
Display a tooltip over an svg element.
@param node {SVG Element} Svg element over which tooltip must be displayed.
@param data {Object} An object of the format
{
title: "tip title",
text: "tip description text",
kvList: {
propertyName1: "property value 1",
..
propertyNameN: "property value N",
}
}
@param event {MouseEvent} Event that triggered the tooltip.
Display a tooltip over an svg element .