Opened 18 years ago
Closed 18 years ago
#6965 closed defect (invalid)
tooltip widgit not able to be attached to gfx element
| Reported by: | Owned by: | Jonas Borgström | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | general | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Branch: | ||
| Release Notes: | |||
| API Changes: | |||
| Internal Changes: | |||
Description
The Tooltip Widget which ultimately uses dijit.placeOnScreenAroundElement(..) does not account for gfx element positioning.
In the placeOnScreenAroundElment method, which is used to place the Tooltip, the following lines:
var aroundNodeW = aroundNode.offsetWidth; //mb.w; var aroundNodeH = aroundNode.offsetHeight; //mb.h;
return NaN for SVG elements (not able to test for VML) and as a result the Tooltip is never positioned on the visible screen. dojo.coords does not return correct position info.
A quick work around for this issue is to attach offsetWidth and offsetHeight properited to the gfx elements based on the generated translation matrix:
offsetWidth = matrix.dx + node.radius offsetHeight = matrix.dy
Code Snippet
node.group = this.surface.createGroup();
node.group.getEventSource().id = node.name+"_group";
node.circle = node.group.createCircle({r:node.radius, cx:0, cy:0}).setFill(node.gradient);
node.circle.getEventSource().id = node.name+"_circle";
node.text = node.group.createText({text:node.name, align:'middle'}).setFill("black");
node.text.getEventSource().id = node.name+"_text";
var matrix = dojox.gfx.matrix.translate(point[0], point[1]);
// HACK: gfx elements to not have the offset* set (or any other positioning) needed by dijit.Tooltip.
node.group.rawNode.offsetWidth = matrix.dx + node.radius;
node.group.rawNode.offsetHeight = matrix.dy;
node.circle.rawNode.offsetWidth = matrix.dx + node.radius;
node.circle.rawNode.offsetHeight = matrix.dy;
node.text.rawNode.offsetWidth = matrix.dx + node.radius;
node.text.rawNode.offsetHeight = matrix.dy;
// end HACK: gfx elements to not have the offset* set (or any other positioning) needed by dijit.Tooltip.
node.group.setTransform(matrix);
node.group.add(node.text).add(node.circle);
this.surface.add(node.group);
new dijit.Tooltip({label: "my tip!", connectId:[node.name+"_group"]});



Wow I am a fool, I totally put this in the WRONG trac! Sorry, please remove.