Add an interception point to allow image URLs to be rewritten

Make all attempts to get a URL for an image go through a single
routine, OpenLayers.Util.getImageLocation, which is given the actual
image name.

This allows users to replace that routine with an enhanced version
which can rewrite the full URL, for example to go through the rails
asset pipeline when using OpenLayers with rails.
This commit is contained in:
Tom Hughes
2011-12-30 18:24:49 +00:00
parent f5ac1fcd72
commit 63fb2d4b04
11 changed files with 27 additions and 21 deletions

View File

@@ -238,9 +238,8 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
// map viewport.
if(!this.outsideViewport) {
this.div.className += " " + this.displayClass + 'Container';
var imgLocation = OpenLayers.Util.getImagesLocation();
// maximize button div
var img = imgLocation + 'layer-switcher-maximize.png';
var img = OpenLayers.Util.getImageLocation('layer-switcher-maximize.png');
this.maximizeDiv = OpenLayers.Util.createAlphaImageDiv(
this.displayClass + 'MaximizeButton',
null,
@@ -256,7 +255,7 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
this.div.appendChild(this.maximizeDiv);
// minimize button div
var img = imgLocation + 'layer-switcher-minimize.png';
var img = OpenLayers.Util.getImageLocation('layer-switcher-minimize.png');
this.minimizeDiv = OpenLayers.Util.createAlphaImageDiv(
'OpenLayers_Control_minimizeDiv',
null,