|
Not bad..
Could use some event smoothing tho..
Defination of event smoothing:
To ensure that you do not concurrent calls to your
code in the event.
I.E.
say we are dragging an object. any
object.
Normally in the ondragmove event you simple tell it
to move itself to the current mous position.
On a high-end computer this is no problem as the
event code tends to be completed before the next call..
On a slower machine tho (or with more code in the
event) things start to get choppy, you grab the object,
drag it accross the screen and then sit back and
wait for it to catch up with you.
(this is a problem I had with my
toolbar)
There are two parts to this solution, both of which
I appled.
the first is an event switch of
soorts..
basically you keep track of when the code is being
executed, and if the code is being executed, don't execute it
again..
if
(!o.dragging){
o.dragging=true; o.moveTo(e.pageX-10,e.pageY-10); o.dragging=false; } this I found smoothed the dragging up a
lot.
The next problem I found was that the test machine
(a P266 with 24 megs of ram running win98)
was working WAY too hard just to drag a little dot
from one end of the screen to the other.
Then I realized.. the event was being called
basically as the mouse moved from one pixel to another..
This was WAY unnessesary I figured.. so, I decided
that the dot should only move when the mouse has moved 5 pixels (picked that
number out of the air so to speak) from it's last location..
l.ondragmove=function(e)
{
e.setBubble(false); var o=e.getTarget(); if (!o.dragging&&(e.pageX-o.x>5||o.x-e.pageX>5||e.pageY-o.y>5||o.y-e.pageY>5)){ o.dragging=true; o.moveTo(e.pageX-10,e.pageY-10); o.dragging=false; } } --
BTW. the 'little dot' was anouther thing I did to
smooth out the dragging, bascially
fixing it so that the browser only has to redraw a
16/16 pixle area rather than the whole damned toolbar.
----
Ac ouple of more tips..
COMPRESS YER DAMNED IMAGES.. I have noted an
improvment of the load-time of my demo
simply after compressing all of the
images..
No, this doeas not mean loosing quality.. you will
find that prodent use of gif compression can result in a WAY smaller image (one
of mine whent from 2,888 bytes to 188!!)
Recomendations:
I believe that some facility for 'event capping' as
I call it should be implemented into the DyAPI..
something like
l.ondragmove=function(e)
{
e.setBubble(false); e.setCapping(true); //<---------------------------------- here. var
o=e.getTarget();
o.moveTo(e.pageX-10,e.pageY-10); } } this would have to be implemented into events.js,
and dragevents.js
Unfortunaly I am not familier with either of those
files and it would be up to someone else to implement it..
Comments? Suggestions?
Doug Melvin
|
- [Dynapi-Help] Presentation... Alan Mukamal
- Re: [Dynapi-Help] Presentation... rlb
- Re: [Dynapi-Help] Presentation... Alan Mukamal
- Re: [Dynapi-Help] Presentation... bob basques
- Re: [Dynapi-Help] Presentation... Alan Mukamal
- RE: [Dynapi-Help] Presentation... Doug Melvin
- RE: [Dynapi-Help] Presentation... Eytan Heidingsfeld
- Re: [Dynapi-Help] Presentatio... Doug Melvin
- Re: [Dynapi-Help] Presentation... Doug Melvin
- RE: [Dynapi-Help] Presentation... Pascal
- Re: [Dynapi-Help] Presentation... David Cushman
