Opened 15 years ago

Closed 14 years ago

Last modified 14 years ago

#165 closed defect (fixed)

Mouse wheel zoom results in multiple redundant image requests

Reported by: chrisclaydon Owned by: zjames
Priority: P2 Milestone:
Component: Widgets Version: SVN
Severity: Major Keywords:
Cc: Browser: All
External ID: Operating System: All
state: Review

Description

When you zoom in with the mouse wheel, it looks like a request is made to the MG server for every incremental click through the mouse wheel detents.

This results in a great number of redundant requests to the server for images that are never even displayed.

The MG AJAX viewer uses setInterval to wait until the user has stopped moving the mouse wheel for 500ms before making a map request.

Fusion/OpenLayers could benefit significantly in performance and scalability by using a similar approach.

Change History (9)

comment:1 by madair, 15 years ago

Resolution: fixed
Status: newclosed

(In [1659]) closes #165: add a timeout to the wheel events

comment:2 by chrisclaydon, 15 years ago

Resolution: fixed
Status: closedreopened

Submission 1659 doesn't really solve the problem. It zooms by the same factor, regardless of the amount the wheel has moved. A solid solution would also need to adjust the zoom of the current map image on the fly, so that the user has an idea of where they're zooming, but delay the request for an updated map image at the necessary scale and resolution until the zooming is done. It's hard to describe in words, but the MG AJAX viewer does a reasonable job of implementing it.

comment:3 by chrisclaydon, 15 years ago

state: Analysis RequestedNew

comment:4 by zjames, 15 years ago

Owner: changed from madair to zjames
state: NewReview
Status: reopenednew

(In [1889]) collect new events until timer expires, then set extents

I'm not sure this is quite right yet, but the approach is to keep collecting wheel events until a timer expires. The timer calls the function that actually changes the extents and makes the map request. Maybe a scale factor is needed somewhere in there.

comment:5 by chrisclaydon, 15 years ago

I don't think the approach of just bundling up wheel events is going to feel right to the end user - each time you roll the mouse wheel through a detent, the map view should zoom in or out, but without actually re-rendering the image (just re-scaling or moving it). The idea is to give an idea of where you're zooming to. If you're zooming in, the displayed map will become blurred, and if you're zooming out, it will no longer fill the screen. That doesn't matter since it's just providing context until the full re-draw occurs when you stop moving the wheel.

comment:6 by zjames, 15 years ago

I looked at how the MapGuide ajax viewer handles this and I can't see a way to achieve it within the context of OpenLayers without essentially replacing the OpenLayers view with a map image. OpenLayers does have a scaling mode but I can't see a way to invoke it that does not fire a request for the map itself, creating the unnecessary draws we're trying to avoid. Things only get more complicated with tiled layers in the view. I didn't test, but does the ajax viewer support this scaling with tiles?

comment:7 by chrisclaydon, 15 years ago

The AJAX Viewer doesn't support the on-the-fly scaling with tiles. It could, but I simply didn't have enough time to write the code to figure out the necessary scaling and translation for all the tiled images.

At one point I wrote a preliminary implementation for single tile images by modifying the OpenLayers code directly. I think it worked, except that it flashed up the wrongly scaled image for a moment just before a redraw. I sent the code to Paul and Mike a long time ago - I don't think I have a copy of it any longer.

comment:8 by madair, 14 years ago

Milestone: 2.02.1
Resolution: fixed
Status: newclosed

I'm only seeing 2 map requests at most and I think using the 'resize' transition effect achieves the desired effect so Im closing this ticket

comment:9 by madair, 14 years ago

Milestone: 2.1

Milestone 2.1 deleted

Note: See TracTickets for help on using tickets.