On 10.4.3 and later you can do the following:
widget.ontransitioncomplete = transitioncomplete
function transitioncomplete () {
// do whatever
}
Note, there is a bug in the implementation where it will be called when you
reload your widget as well. So you may want to protect the method by
setting a global when you do a transition.
Thanks,
jl
Hi Matt,
That solution works great. Thanks. I had actually tried that but I
didn't use
enough milliseconds.
I now have a workable solution, yet it would be really nice if the height
> increase could be applied before
'window.widget.performTransition();' so that
the resizing of the widget would not be visible to the user.
Seeing the widget
snap to its former size after back to front transition kind of looks like a
design flaw. Do you see what I mean? Should there be an enhancement request
for for resizing before performTransition? Or, would having a
"transitionFinished" notification make the resize much less
visible because of
the improved timing?
Thanks,
Chuck
At 2:40 PM -0800 11/4/05, Matt Drance wrote:
Hi Chuck,
You can use the Stretcher example to get to the correct size before the
transition. Since the Stretcher has a callback for a completed
stretch, you
can do the following:
1) info button click starts the stretch
2) stretch to desired size; stretch callback performs transition
function flipClick (event) {
if (!stretcher.isStretched()) {
stretcher.onFinished = showPrefs;
stretcher.stretch();
} else {
showPrefs();
}
}
function showPrefs () {
if (window.widget) {
window.widget.prepareForTransition("ToBack");
}
document.getElementById("front").style.display = "none";
document.getElementById("back").style.display = "block";
if (window.widget) {
setTimeout("window.widget.performTransition()", 0);
}
}
When going back to the front, you can do a delayed "shrink" that
will go back
to the appropriate front height after the front transition is
complete, like
below. This is a little sketchy because it assumes a specific time interval
for the transition to be performed. There is already an
enhancement request
for a "transitionFinished" notification which would make this less sketchy.
function goToFront () {
if (window.widget) {
window.widget.prepareForTransition("ToFront");
}
document.getElementById("back").style.display = "none";
document.getElementById("front").style.display = "block";
>> var stretcherTimeout = 0;
if (window.widget) {
setTimeout("window.widget.performTransition();", 0);
stretcherTimeout = 800; // give some time for the transition
}
if (stretcher.onFinished == showPrefs && stretcher.isStretched()) {
// We stretched in order to show the prefs; shrink back when
>> the front is shown
stretcher.onFinished = returnFrontState;
>> setTimeout("stretcher.stretch();", stretcherTimeout);
}
}
----------------------------------------------
Matt Drance
DTS Engineer
Java - Dashboard - Address Book
email@hidden
On Nov 4, 2005, at 2:09 PM, Chuck Soper wrote:
This message is a little long - feel free to just read the last paragraph.
I have a widget has a variable height on the front and a fixed height for
the backside. When the front is taller than the back, I have a problem
flipping the widget from back to front.
It doesn't appear to be possible to increase the height of the
widget before
preparing or performing the transition from back to front.
Because of this,
the flip transition is not smooth at all. I see the first half of the back
to front transition animation then the front suddenly appears.
The work-around to this problem is to use the same height for
the front and
the backside whenever the front is taller than the back. This is the
approach that the Stocks widget takes. The purpose of the
resizedWhenFlippedOver boolean in Stocks.js is to remember when
the front is
shorter than the back otherwise the height of the backside is not resized
during front to back transitions. This can be verified by doing the
following:
- use seven or more stock symbols.
- flip the Stocks to its backside.
- mouse down on the widget and deactivate the dashboard to
bring the widget
to the desktop (you need to have debugmode turned on).
- Capture the window using Grab.
Notice that the height of the backside graphic equals the height of the
front side.
The reason that I don't want to use this work-around is because I need to
have backside elements that are offset from the bottom of the
widget not the
top.
Is it possible to increase the height of the widget during back to front
transition and have smooth animation of the flip? The fact that the Stocks
widget uses a special case to avoid that scenario suggests that
this is not
possible. Does anyone know otherwise? If not, I can file a bug report.
Chuck
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/email@hidden
<http://lists.apple.com/mailman/options/dashboard-dev/email@hidden>
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/email@hidden
This email sent to email@hidden
--------------------------------------------------
John Louch Internet #: email@hidden
(805) 541 2965
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/email@hidden
This email sent to email@hidden