Time Slider UI - Possible bug

140 views
Skip to first unread message

Greg-WBSR

unread,
Jul 7, 2010, 7:27:42 PM7/7/10
to KML Developer Support - Google Earth Plug-in
Hi Everyone,

I have been playing with the newest addition to the plugin - the
ability to show/hide the time slider UI.

I am having problems making the UI hidden completely. I have no
problems hiding the UI once it is shown, but I would prefer to not
show it in the first place.

I have setup a page where I have a demo of what I am referring to, but
ask you to read ALL this post before visiting the page.

1. When you initially load the page, you will see 2 buttons under the
GE window - one that says ' load springboard tour with UI' and one
that says 'load springboard tour and hide UI'

If you click the one WITH the UI, it loads the tour and timeline - no
worries. However, you need to click it again to make the tour play. If
you now close the tour (all using the tour controls in the GE window),
and now click the same 'load with UI' button - it should load the tour
AND start playing - and will continue to behave this way until you
refresh the page.

My code includes a ge.getTourPlayer().play(); and I want to auto-play
the tour, but can't work out why it doesn't on the first page load.

2. If you refresh the page, and now click the button with 'HIDE UI' -
it should load the tour without displaying the UI - however it has the
same deal as the other button, in that you need to click it twice to
play the tour - then it will work everytime.

Now the fun stuff - try refreshing the page once again, and try the
tour WITH the UI - I am finding it no longer shows the UI - even
though it should be - still has same deal with having to click twice
for it to play. It is as if the 'disable UI' is still activated upon a
page refresh.

Also, if you play with the 'enable' and 'disable' buttons - leave the
UI enabled - then refresh the page - I am finding a lot of the time
the UI is now showing on initial page load - even though there is no
kml loaded (let alone one with timestamps)

I have tried using the 'disable Ui' function in the init() and
initCB(object) functions, but it doesn't seem to do anything. It seems
that you can't disable the UI, until AFTER it has already been shown.

Lastly, and this doesn't seem to happen until you have been playing
with it for a while - but eventually I get to a stage where I have a
'bug' image of the UI showing - you can see the image in this
screenshot

http://whistlervisitorguide.com/trailmap/timesliderbug.jpg

that 'bug' image stays there even during a refresh - and can still be
there the next day when I first load the page. you need to 'enable'
the UI and then 'disable' it to make it go away.

here is the page with my demo
http://whistlervisitorguide.com/trailmap/

I admit it is hard to duplicate the 'bug' image - I have been trying
to find a way to make it happen before posting, but no luck.

I do have another page, which seems to get the image 'bug' a lot more
(still can't find a way to make it happen) - but it also contains
everything else I am working on - and I would rather not make it
public (yet).

However, if Josh or another Google rep wants to see it, please email
me (or tell me to email you) and I will share the URL.

So to recap-
1. I would like to find a way to make the track/tour load AND play
upon the initial loading of the page, with just 1 click.
2. I would to find a way which ensures the timeline UI is never shown.

Maybe I am missing something very simple??

Any help is appreciated.

Thanks
Greg

Greg-WBSR

unread,
Jul 7, 2010, 7:29:55 PM7/7/10
to KML Developer Support - Google Earth Plug-in
Sorry if this is a double post, but my first attempt didn't seem to
work .....

Greg-WBSR

unread,
Jul 8, 2010, 3:27:01 PM7/8/10
to KML Developer Support - Google Earth Plug-in
I have just noticed a change in the code for hiding the UI in the API
reference compared to the demo page I was using.

ge.getTime().getControl().setVisibility(true)
vs
ge.getTime().getControl().setVisibility(ge.VISIBILITY_SHOW);

I have updated both this demo page of mine, and my other one, but the
problem still remains.

It seems to happen mostly when I load the page for the first time each
day, afterwards it seems to load okay

Greg
> here is the page with my demohttp://whistlervisitorguide.com/trailmap/

Josh L

unread,
Jul 8, 2010, 4:14:33 PM7/8/10
to KML Developer Support - Google Earth Plug-in
Hi Greg,

Thanks for the details and the demo page. It makes this much easier
to debug!

First, I should mention that it's not unlikely to find the occasional
quirk in a developer pre-release, and that we're aware of some of the
issues with the setVisibility method of the Time UI and intend to
change the behavior a little in the future.

With that in mind, I believe both these issues are currently related
to calling code that interacts with the UI control before the UI has
completely loaded. If you wrap your calls in a short timeout, these
issues may go away. For example:
setTimeout("ge.getTourPlayer().play()", 250);

Let me know how it goes.

Cheers,

-Josh




On Jul 7, 4:29 pm, Greg-WBSR wrote:
> here is the page with my demohttp://whistlervisitorguide.com/trailmap/

Greg-WBSR

unread,
Jul 10, 2010, 8:49:02 PM7/10/10
to KML Developer Support - Google Earth Plug-in
Hi Josh,

I have implemented some time delays like you suggested.
It definitely worked to allow the tour to start playing upon the first
click.
It is too early to tell whether it has helped the UI 'bug' - but so
far it hasn't occurred.
Still, using a timer is more of a 'hack' fix isn't it?

Thanks
Greg

Josh L

unread,
Jul 12, 2010, 12:17:30 PM7/12/10
to KML Developer Support - Google Earth Plug-in
Hi Greg,

Yes - certainly it is a bit of a hack. Ideally we would have a more
robust mechanism in place, such as an event that fires to let you know
when the controls are ready for use. And we do have some events like
this (for example, there is an historicalimageryready event that fires
when the Time Machine/Historical Imagery is ready). I think this
would be a useful feature request, and we do intend to add new events
that will be useful to developers as we move forward -- but in the
meantime a very short delay should do the trick.

Cheers,

-Josh

mcahornsirup

unread,
Jul 15, 2010, 9:23:20 AM7/15/10
to KML Developer Support - Google Earth Plug-in
@Josh, great solution again! Ok - it is not that elegant, but it
solved my problem. Without the timeout parts, the timeslider occured
in a broken way.

instead of:
ge.getTime().getControl().setVisibility(ge.VISIBILITY_HIDE)

I use now:
setTimeout("ge.getTime().getControl().setVisibility(ge.VISIBILITY_HIDE)",
250);


Thanks!



On 12 Jul., 18:17, Josh L wrote:
> Hi Greg,
>
> Yes - certainly it is a bit of a hack.  Ideally we would have a more
> robust mechanism in place, such as an event that fires to let you know
> when the controls are ready for use.  And we do have some events like
> this (for example, there is an historicalimageryready event that fires
> when theTimeMachine/Historical Imagery is ready).  I think this
> would be a useful feature request, and we do intend to add new events
> that will be useful to developers as we move forward -- but in the
> meantime a very short delay should do the trick.
>
> Cheers,
>
>   -Josh
>
> On Jul 10, 5:49 pm, Greg-WBSR wrote:
>
>
>
> > Hi Josh,
>
> > I have implemented sometimedelays like you suggested.
> > It definitely worked to allow the tour to start playing upon the first
> > click.
> > It is too early to tell whether it has helped the UI 'bug' - but so
> > far it hasn't occurred.
> > Still, using a timer is more of a 'hack' fix isn't it?
>
> > Thanks
> > Greg
>
> > On Jul 8, 1:14 pm, Josh L wrote:
>
> > > Hi Greg,
>
> > > Thanks for the details and the demo page.  It makes this much easier
> > > to debug!
>
> > > First, I should mention that it's not unlikely to find the occasional
> > > quirk in a developer pre-release, and that we're aware of some of the
> > > issues with the setVisibility method of theTimeUI and intend to
> > > change the behavior a little in the future.
>
> > > With that in mind, I believe both these issues are currently related
> > > to calling code that interacts with the UI control before the UI has
> > > completely loaded.  If you wrap your calls in a short timeout, these
> > > issues may go away.  For example:
> > > setTimeout("ge.getTourPlayer().play()", 250);
>
> > > Let me know how it goes.
>
> > > Cheers,
>
> > >   -Josh
>
> > > On Jul 7, 4:29 pm, Greg-WBSR wrote:
>
> > > > Sorry if this is a double post, but my first attempt didn't seem to
> > > > work .....
>
> > > > Hi Everyone,
>
> > > > I have been playing with the newest addition to the plugin - the
> > > > ability to show/hide thetimeslider UI.

mcahornsirup

unread,
Jul 27, 2010, 8:24:18 AM7/27/10
to KML Developer Support - Google Earth Plug-in
I just dived deeper into this issue and in my case, the timeout is not
sufficient.

Here is my goal:

Due to the missing replay speed controls of the time slider, I wanted
to develop my own timeslider with speed control.
To achieve this goal, I'am using jquery ui sliders. It works pretty
well when making use of the frameend feature of GE-Plugin.

Afterwards, I tried to set the timesliders visibility to
VISIBILITY_HIDE. I ended up with the described broken ge time slider,
half visible.
CODE:
ge.getTime().getControl().setVisibility(ge.VISIBILITY_HIDE);

With the setTimeout approach, it is still visible for a short time.
Not for a long time, but this is still disturbing the user experience.
CODE:
setTimeout("ge.getTime().getControl().setVisibility(ge.VISIBILITY_HIDE)",
250);

I tried to envoke VISIBILITY_HIDE / VISIBILITY_SHOW, to overcome this
issue, but it did not work.
CODE:
ge.getTime().getControl().setVisibility(ge.VISIBILITY_HIDE);
CODE:
ge.getTime().getControl().setVisibility(ge.VISIBILITY_SHOW);
CODE:
ge.getTime().getControl().setVisibility(ge.VISIBILITY_HIDE);

I tried to leave the earth in the dark, until I made my init stuff -
adding a timespan, wait a second and hide the timeslider and than show
the earth.
But it seems like the I'am not able to hide the earth. I logged the
result, and the visibility is set correctly, but the earth becomes
visible. Therefore, my init stuff is displayed.
CODE: ge.getWindow().setVisibility(false);
CODE: // do init stuff
CODE: ge.getWindow().setVisibility(true);

Finally, I realized, that only the first time when loading KML with
timespans inside, this happens. Therefore, I found a little workaround
by explicitly loading a simple placemark, wait a second and hide the
UI.

WORKAROUND:

// We ar loading the GE like before.
function initCB(instance) {

ge = instance;
ge.getWindow().setVisibility(true);

// WE BUILD A PLACEMARK CONTAINING A TIMESTAMP AND
APPEND IT!
placemark =
ge.createPlacemark('TimesliderVisibilityFix');
placemark.setVisibility(false);

var timeStamp = ge.createTimeStamp('');
timeStamp.getWhen().set('2010-06-19T12:40:00Z');

placemark.setTimePrimitive(timeStamp);
ge.getFeatures().appendChild(placemark);

// CALLED WITH AN OFFSET
setTimeout('initCBOffset()', 250);
}

// HERE WE FIX THE TIMESLIDER ISSUE
function initCBOffset(){

placemark.setVisibility(true);

ge.getTime().getControl().setVisibility(ge.VISIBILITY_HIDE);
placemark.setVisibility(false);
ge.getFeatures().removeChild(placemark);
placemark = null;

... load/fetch your real KML or whatever : )
Reply all
Reply to author
Forward
0 new messages