- From: Vincent Hardy <vincent.hardy@sun.com>
- Date: Thu, 10 Oct 2002 09:40:43 +0200
- To: "Harmon S. Nine" <hnine@netarx.com>
- CC: www-svg@w3.org
Harmon, The SVGSVGElement interface has methods to deal with immediate redraw (or suspending of redraw): interface SVGSVGElement : ... { ... unsigned long suspendRedraw ( in unsigned long max_wait_milliseconds ); void unsuspendRedraw ( in unsigned long suspend_handle_id ) raises( DOMException ); void unsuspendRedrawAll ( ); void forceRedraw ( ); void pauseAnimations ( ); void unpauseAnimations ( ); ... }; I do not know if the Adobe viewer supports it though. Vincent. Harmon S. Nine wrote: > > Hi all. > > Does anyone have a better solution for doing this? > > > I'm using the adobe SVG and was wondering how to display text in an SVG > document that indicates that a given (relatively long) task is in > progress and the user should wait ... > > He're the scenario. On a mousemove event, I'm hiding all text in the > document to improve dynamic performance. However, hiding all of the > text takes a while (a second or two). So, in the event-handler for > mousemove, I'd like to update a "status" text element (that is not > hidden :-) to say "Hiding text elements -- please wait ..." just before > the operation(s) that hide the text. Here's a code snippet: > > function handleMouseMove(event) { > status.nodeValue = "Hiding text elements -- please wait ..."; > /* HIDE THE TEXT */ > for(ix = textNodes.length ; --ix >= 0 ;) { > textNodes[ix].displayAttr.value = "none"; > } > } > > The problem is that the SVG display does not update the "status" text > element with this message until the entire event handler has executed, > i.e. including the text-hiding operations. Thus what the user > experiences is a few seconds of unresponsiveness, followed by the text > being hidden and the "status" text saying "Hiding text elements -- > please wait ...", which isn't very helpful. > > The only solution I've found is to split the event handler into two > functions. One function updates the "status" text element and then > schedules the second function (which hides the text elements) to run 50 > milliseconds later via setTimeout. Apparently, 50 milliseconds is > enough time for the SVG display to update. Here's the code: > > function handleMouseEvent(event) { > status.nodeValue = "Hiding text elements -- please wait ..."; > setTimeout("hideText()", 50); > } > > function hideText() { > /* HIDE THE TEXT */ > for(ix = textNodes.length ; --ix >= 0 ;) { > textNodes[ix].displayAttr.value = "none"; > } > } > > > This is IMHO a horrible kludge, but its the only thing that works. > > If anyone has a better solution, I'd be most appreciative. :-) > > TIA > > -- Harmon S. Nine >
Received on Thursday, 10 October 2002 03:47:32 UTC