1

我正在使用 Raphael JS 绘制矩形对象。JS 编码由运行时转换为 ABAP 编码并显示在内部浏览器中。虽然显示一切都很好,但我想在将鼠标移到 SVG 对象上时发布一个特定的 Qucikinfo。有谁知道如何通过矩形对象发布快速信息?通过单击对象获得信息也可以。我不想使用圆形对象..

阿巴普:

CONCATENATE: 'var' a_name '= paper.rect(' a_x_pos ',' a_y_pos ','
a_width ',' a_height ',' a_corner_radius ');'
INTO l_html_line SEPARATED BY space.

js:

var name = paper.rect( x_pos, y_pos, width, height, corner_radius)
4

1 回答 1

0

你可以看看这个:http ://stratha.us/raphael_js_tooltip

代码非常小:

Raphael.el.tooltip = function (tp) {
  this.tp = tp;
  this.tp.ox = 0;
  this.tp.oy = 0;
  this.tp.hide();
  this.hover(
    function(event) { 
      this.mousemove(function(event) { 
        this.tp.translate(event.clientX - 
          this.tp.ox,event.clientY - this.tp.oy);
        this.tp.ox = event.clientX;
        this.tp.oy = event.clientY;
      });
      this.tp.show().toFront();
    }, 
    function(event) {
      this.tp.hide();
      this.unmousemove();
    }
  );
  return this;
};

然后你只需要打电话

name.tooltip( paper.text( 0 , 0 , "Hi, I am a tooltip" ) );

另一方面,ABAP 代码看起来非常难以维护。我会邀请您在 codereview.stackexchange.com 上发布整个代码,我相信有更好的方法来做到这一点。

于 2013-05-28T13:39:06.213 回答