Use css sprites technique to simplify the NavigationHistory controls. r=tschaub. (Closes #1555)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@7422 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -17,18 +17,7 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var map, nav, panel;
|
var map, nav, panel;
|
||||||
|
|
||||||
// preload images if you care
|
function init() {
|
||||||
var preload = [
|
|
||||||
"../theme/default/img/view_previous_on.png",
|
|
||||||
"../theme/default/img/view_next_on.png"
|
|
||||||
];
|
|
||||||
var img = new Array(preload.length);
|
|
||||||
for(var i=0; i<preload.length; ++i) {
|
|
||||||
img[i] = new Image();
|
|
||||||
img[i].src = preload[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
function init(){
|
|
||||||
map = new OpenLayers.Map('map');
|
map = new OpenLayers.Map('map');
|
||||||
|
|
||||||
nav = new OpenLayers.Control.NavigationHistory();
|
nav = new OpenLayers.Control.NavigationHistory();
|
||||||
@@ -48,8 +37,6 @@
|
|||||||
);
|
);
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
map.zoomToMaxExtent();
|
map.zoomToMaxExtent();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -137,14 +137,14 @@ OpenLayers.Control.NavigationHistory = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
|
|
||||||
var previousOptions = {
|
var previousOptions = {
|
||||||
trigger: OpenLayers.Function.bind(this.previousTrigger, this),
|
trigger: OpenLayers.Function.bind(this.previousTrigger, this),
|
||||||
displayClass: this.displayClass + "Previous"
|
displayClass: this.displayClass + " " + this.displayClass + "Previous"
|
||||||
};
|
};
|
||||||
OpenLayers.Util.extend(previousOptions, this.previousOptions);
|
OpenLayers.Util.extend(previousOptions, this.previousOptions);
|
||||||
this.previous = new OpenLayers.Control.Button(previousOptions);
|
this.previous = new OpenLayers.Control.Button(previousOptions);
|
||||||
|
|
||||||
var nextOptions = {
|
var nextOptions = {
|
||||||
trigger: OpenLayers.Function.bind(this.nextTrigger, this),
|
trigger: OpenLayers.Function.bind(this.nextTrigger, this),
|
||||||
displayClass: this.displayClass + "Next"
|
displayClass: this.displayClass + " " + this.displayClass + "Next"
|
||||||
};
|
};
|
||||||
OpenLayers.Util.extend(nextOptions, this.nextOptions);
|
OpenLayers.Util.extend(nextOptions, this.nextOptions);
|
||||||
this.next = new OpenLayers.Control.Button(nextOptions);
|
this.next = new OpenLayers.Control.Button(nextOptions);
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 6.9 KiB |
+9
-14
@@ -128,29 +128,24 @@ div.olControlMousePosition {
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.olControlNavigationHistoryPreviousItemActive {
|
.olControlNavigationHistory {
|
||||||
background-image: url("img/view_previous_on.png");
|
background-image: url("img/navigation_history.png");
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
width: 24px;
|
width: 24px;
|
||||||
height: 24px;
|
height: 24px;
|
||||||
|
|
||||||
|
}
|
||||||
|
.olControlNavigationHistoryPreviousItemActive {
|
||||||
|
background-position: 0px 0px;
|
||||||
}
|
}
|
||||||
.olControlNavigationHistoryPreviousItemInactive {
|
.olControlNavigationHistoryPreviousItemInactive {
|
||||||
background-image: url("img/view_previous_off.png");
|
background-position: 0px -24px;
|
||||||
background-repeat: no-repeat;
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
}
|
}
|
||||||
.olControlNavigationHistoryNextItemActive {
|
.olControlNavigationHistoryNextItemActive {
|
||||||
background-image: url("img/view_next_on.png");
|
background-position: -24px 0px;
|
||||||
background-repeat: no-repeat;
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
}
|
}
|
||||||
.olControlNavigationHistoryNextItemInactive {
|
.olControlNavigationHistoryNextItemInactive {
|
||||||
background-image: url("img/view_next_off.png");
|
background-position: -24px -24px;
|
||||||
background-repeat: no-repeat;
|
|
||||||
width: 24px;
|
|
||||||
height: 24px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.olControlNavToolbar .olControlNavigationItemActive {
|
.olControlNavToolbar .olControlNavigationItemActive {
|
||||||
|
|||||||
Reference in New Issue
Block a user