javascript - IE smoothing a map pan when dragging -


I have tried to reduce the display of the map application using javascript.

  • onmouseem
  • But in IE it seems that I initially implemented a dragging pane

    • onmousedown
    • Onmousemove
    • Actually sluggish and it appears that when you move the cursor faster, the map is not updated until you move on.

      I changed my code to use native IE events

      • ondragstart
      • ondrag
      • ondragend

      The performance was better while using these events, but it seems that I can not set the mouse cursor using standard CSS properties. I can only determine the cursor for some predefined people I do not want.

      So my question is how can I either simplify the drag in IE using the first set of events or how can I set a custom cursor using native events.

      Edit: Code sample

      The code is very simple even when I remove the argument to load the new tiles ( I.e. only being transferred to the container) it is still crappy below the pan function:

        // "This" indicates all the tile layers related to the object div. SlideMap (e) function {E = E || Window.event; Var dx = this.mouseX - e.clientX; Var dy = this.mouseY - e.clientY; If (dx! == 0 = DE! == 0) {this.style.left = parseInt (this.style.left) + dx + 'px'; This.style.top = parseInt (this.style.top) + DI + 'PX'; This.mouseX = e.clientX; This.mouseY = e.clientY; }}  

    It's really hard to say, without code examples

    The slowing effect may be due to some execution you are running within the event execution. The event system in the browser is really interesting, it is synchronous which means that the event will not start again until the current execution is finished.

    This means, you have two possibilities: 1. Optimize your code inside the event, so that it takes less CPU time or 2. 2. Make your event asynchronous and apply your own mute x / sfile logic.

    You can do the second by using the setTimeout functionality, if you set the set time time, ((code), 1) your event will continue asynchronously, so to complete the next code Without waiting. Okay, take advance, in that case you have to start thinking about locking and money. By queuing I mean, to queue all the transmitted events for future use.

    Due to some heavy code execution, before long, I also did some asynchronous transmission. It worked for me, maybe it will work for you too.


    Comments

    Popular posts from this blog

    sql - dynamically varied number of conditions in the 'where' statement using LINQ -

    asp.net mvc - Dynamically Generated Ajax.BeginForm -

    Debug on symbian -