Ticket #6369 (closed defect: duplicate)

Opened 8 months ago

Last modified 7 months ago

dojox.fx.sizeTo Initialization bug?

Reported by: guest Owned by: dante
Priority: normal Milestone:
Component: Dojox Version: 1.0
Severity: normal Keywords:
Cc: ole.ersoy@…

Description

Hi,

I first collapse a node with ID "collapse", then I expand another node with ID "expand". I want the node expanding to expand from the center where the collapsed node collapsed. So prior to creating the sizing animation that expands the "expand" node, I set the top and left coordinates to the coordinates of the collapsed node.

However the expand animation resets the coordinates to 0,0, before the animation runs.

Here's are the debug statements I placed inside the dojox.fx.sizeTo init routine:

var init = (function(){

var innerNode = node; return function(){

var pos = compute(innerNode).position;

top = (pos == 'absolute' ? node.offsetTop : parseInt(compute(node).top) 0);

left = (pos == 'absolute' ? node.offsetLeft : parseInt(compute(node).left) 0);

console.debug("NodeID is: " + innerNode.id); console.debug("innerNode.style.top: " + innerNode.style.top); console.debug("innerNode.style.left: " + innerNode.style.left);

console.debug("Calculated Top is: " + top); console.debug("Calculated Left is: " + left);

Here's the result when running the test:

NodeID is: collapse

innerNode.style.top: 400px

innerNode.style.left: 400px

Calculated Top is: 400

Calculated Left is: 400

NodeID is: collapse

innerNode.style.top: 400px

innerNode.style.left: 400px

Calculated Top is: 400

Calculated Left is: 400

NodeID is: expand

innerNode.style.top: 449.997px

innerNode.style.left: 449.996px

Calculated Top is: 0

Calculated Left is: 0

NodeID is: expand

innerNode.style.top: 449.997px

innerNode.style.left: 449.996px

Calculated Top is: 450

Calculated Left is: 450

dojox.fx.sizeTo runs the init code twice. The first time it runs it it calculates the top and left coordinates that it uses, which end up being 0,0, even though they should be 450, 450. The second time it calculates the right coordinates, but these are not used.

Thoughts?

Thanks, - Ole

Change History

Changed 8 months ago by peller

  • owner changed from anonymous to dante
  • component changed from General to Dojox

Changed 8 months ago by guest

If I change the top and left calculation to this, it works the way I would expect it to work:

top = (pos == 'absolute' ? parseInt(node.style.top) : parseInt(compute(node).top) 0);

left = (pos == 'absolute' ? parseInt(node.style.left) : parseInt(compute(node).left) 0);

Changed 7 months ago by dante

  • status changed from new to closed
  • resolution set to duplicate

of #6275

Note: See TracTickets for help on using tickets.