Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

#6965 closed defect (invalid)

tooltip widgit not able to be attached to gfx element

Reported by: macasek@… 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"]});

Attachments (0)

Change History (1)

comment:1 by macasek@…, 17 years ago

Resolution: invalid
Status: newclosed

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

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.