Opened 12 years ago

Closed 12 years ago

#6369 closed defect (duplicate)

dojox.fx.sizeTo Initialization bug?

Reported by: guest Owned by: dante
Priority: high Milestone:
Component: Dojox Version: 1.0
Keywords: Cc: ole.ersoy@…
Blocked By: Blocking:

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) left = (pos == 'absolute' ? node.offsetLeft : parseInt(compute(node).left)
0);
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 (3)

comment:1 Changed 12 years ago by Adam Peller

Component: GeneralDojox
Owner: changed from anonymous to dante

comment:2 Changed 12 years 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) left = (pos == 'absolute' ? parseInt(node.style.left) : parseInt(compute(node).left)
0);
0);

comment:3 Changed 12 years ago by dante

Resolution: duplicate
Status: newclosed

of #6275

Note: See TracTickets for help on using tickets.