[Mapbender-commits] r8605 - branches/2.7/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Apr 22 05:58:38 PDT 2013
Author: astrid_emde
Date: 2013-04-22 05:58:38 -0700 (Mon, 22 Apr 2013)
New Revision: 8605
Modified:
branches/2.7/http/javascripts/mod_overviewToggle.js
Log:
new element var overviewToggle_position
* http://trac.osgeo.org/mapbender/ticket/897
* http://trac.osgeo.org/mapbender/ticket/898
Modified: branches/2.7/http/javascripts/mod_overviewToggle.js
===================================================================
--- branches/2.7/http/javascripts/mod_overviewToggle.js 2013-04-18 12:19:14 UTC (rev 8604)
+++ branches/2.7/http/javascripts/mod_overviewToggle.js 2013-04-22 12:58:38 UTC (rev 8605)
@@ -26,8 +26,16 @@
* > INSERT INTO gui_element_vars (fkey_gui_id, fkey_e_id, var_name,
* > var_value, context, var_type) VALUES ('<app_id>', 'overviewToggle',
* > 'initialOpen', 'false',
- * > '' ,'var');
+ * > 'default is false' ,'var');
* >
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name,
+ * > var_value, context, var_type) VALUES('<app_id>', 'overviewToggle', 'overviewToggle_position',
+ * > 'ur', 'define a position for the overviewToggle - ur and lr is possible or false' ,'var');
+ * >
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name,
+ * > var_value, context, var_type) VALUES('<app_id>', 'overviewToggle',
+ * > 'overviewToggle_position_offset_top', '0', 'define an offset for the div tag' ,'var');
+ * >
* Help:
* http://www.mapbender.org/OverviewToggle
*
@@ -40,20 +48,39 @@
* and Simplified BSD license.
* http://svn.osgeo.org/mapbender/trunk/mapbender/license/license.txt
*/
-options.initialOpen = options.initialOpen ? true : false;
+if (!options.initialOpen ) {
+ options.initialOpen = false;
+}
var ovSwitchTarget = options.target[0];
var ovSwitchId = options.id;
var overview_visible = options.initialOpen;
+if (!options.overviewToggle_position_offset_top) {
+ var overviewToggle_position_offset_top = 0;
+}else{
+ var overviewToggle_position_offset_top = options.overviewToggle_position_offset_top;
+}
+
+if (!options.overviewToggle_position) {
+ var overviewToggle_position = false;
+}else{
+ var overviewToggle_position = options.overviewToggle_position;
+}
+
+if (!options.target[1]) {
+ var ovMapframeTarget = 'mapframe1';
+}else{
+ var ovMapframeTarget = options.target[1];
+}
+
//▶
//◀
-eventInit.register(function () {
-
var $ov = $("#" + ovSwitchTarget);
var $this = $("#" + ovSwitchId);
+
var $ovToggleButton = $("#" + ovSwitchId + " > span");
var overviewInitialWidth = $ov.width();
var overviewInitialHeight = $ov.height();
@@ -61,16 +88,105 @@
var overviewLeft = parseInt($ov.css("left"), 10);
var overviewInitialOuterWidth = $ov.outerWidth();
- $ov.css({
- display:"block",
- top: (overviewInitialTop + 26) + "px",
- borderWidth: "0px",
- borderStyle: "solid",
- borderColor: "#176798"
+ var $mf = $("#" + ovMapframeTarget);
+ var mapframeLeft = parseInt($mf.css("left"), 10);
+ var mapframeHeight = parseInt($mf.css("height"), 10);
+ var mapframeWidth = parseInt($mf.css("width"), 10);
+ var mapframeTop = parseInt($mf.css("top"), 10);
+
+if (overviewToggle_position == 'lr' || overviewToggle_position == 'ur'){
+ eventAfterMapRequest.register(function () {
+ mod_overviewToggleRefreshPosition();
});
+}
+
+
+eventInit.register(function () {
+ mod_overviewToggle();
+});
- if (!overview_visible) {
+function mod_overviewToggleRefreshPosition(){
+ if(mapframeWidth != parseInt($mf.css("width"), 10) && overviewToggle_position != false){
+ mapframeWidth = parseInt($mf.css("width"), 10);
+ mapframeHeight = parseInt($mf.css("height"), 10);
+ if (overviewToggle_position == 'lr'){
+ $ov.css({
+ display:"block",
+ top: (mapframeTop + mapframeHeight - overviewToggle_position_offset_top - overviewInitialHeight) + "px",
+ left: (mapframeLeft + mapframeWidth - overviewInitialWidth) + "px",
+ borderWidth: "0px",
+ borderStyle: "solid",
+ borderColor: "#176798"
+ });
+ }else if (overviewToggle_position == 'ur'){
+ $ov.css({
+ display:"block",
+ top: (mapframeTop + overviewToggle_position_offset_top) + "px",
+ left: (mapframeLeft + mapframeWidth - overviewInitialWidth) + "px",
+ borderWidth: "0px",
+ borderStyle: "solid",
+ borderColor: "#176798"
+ });
+ }
+
+ if (overview_visible == false){
+ var leftovt = mapframeLeft + mapframeWidth - 35;
+ }else{
+ var leftovt = mapframeLeft + mapframeWidth - overviewInitialWidth;
+ }
+
+ if (overviewToggle_position == 'lr'){
+ $this.css({
+ display:"inline-block",
+ left: leftovt + "px",
+ left: leftovt + "px",
+ top: (mapframeTop + mapframeHeight - 26 ) + "px",
+ zIndex: $ov.css("zIndex")
+ });
+ }else if (overviewToggle_position == 'ur'){
+ $this.css({
+ display:"inline-block",
+ left: leftovt + "px",
+ top: (mapframeTop + overviewToggle_position_offset_top - 26) + "px",
+ zIndex: $ov.css("zIndex")
+ });
+ }
+ }
+}
+
+
+function mod_overviewToggle(){
+ if (overviewToggle_position == 'lr'){
$ov.css({
+ display:"block",
+ top: (mapframeTop + mapframeHeight - overviewToggle_position_offset_top - overviewInitialHeight) + "px",
+ left: (mapframeLeft + mapframeWidth - overviewInitialWidth) + "px",
+ borderWidth: "0px",
+ borderStyle: "solid",
+ borderColor: "#176798"
+ });
+ }else if (overviewToggle_position == 'ur'){
+ $ov.css({
+ display:"block",
+ top: (mapframeTop + overviewToggle_position_offset_top) + "px",
+ left: (mapframeLeft + mapframeWidth - overviewInitialWidth) + "px",
+ borderWidth: "0px",
+ borderStyle: "solid",
+ borderColor: "#176798"
+ });
+ }else{
+ $ov.css({
+ display:"block",
+ top: (overviewInitialTop + 26) + "px",
+ borderWidth: "0px",
+ borderStyle: "solid",
+ borderColor: "#176798"
+ });
+ }
+
+
+ if (!overview_visible || overview_visible == false) {
+ $ov.css({
display:"none",
left: overviewLeft + "px"
});
@@ -80,14 +196,31 @@
$ovToggleButton.removeClass("ui-icon-triangle-1-e").addClass("ui-icon-triangle-1-w");
}
- $this.css({
- display:"inline-block",
- left: overviewLeft + "px",
- top: overviewInitialTop + "px",
- zIndex: $ov.css("zIndex")
- });
- $ovToggleButton.mouseover(function () {
+ if (overviewToggle_position == 'lr'){
+ $this.css({
+ display:"inline-block",
+ left: (mapframeLeft + mapframeWidth - overviewInitialWidth) + "px",
+ top: (mapframeTop + mapframeHeight - 26 ) + "px",
+ zIndex: $ov.css("zIndex")
+ });
+ }else if (overviewToggle_position == 'ur'){
+ $this.css({
+ display:"inline-block",
+ left: (mapframeLeft + mapframeWidth - overviewInitialWidth) + "px",
+ top: (mapframeTop + overviewToggle_position_offset_top - 26) + "px",
+ zIndex: $ov.css("zIndex")
+ });
+ }else{
+ $this.css({
+ display:"inline-block",
+ left: overviewLeft + "px",
+ top: overviewInitialTop + "px",
+ zIndex: $ov.css("zIndex")
+ });
+ }
+
+ $this.mouseover(function () {
this.style.cursor = "pointer";
}).mouseout(function () {
this.style.cursor = "default";
@@ -105,9 +238,17 @@
borderWidth: "0px",
borderStyle: "solid",
borderColor: "#176798"
- });
+ });
+
+ if (overviewToggle_position != 'false' && overviewToggle_position != false){
+ var leftovt = mapframeLeft + mapframeWidth - 35;
+ }else{
+ var leftovt = overviewLeft;
+ }
+
$this.animate({
- width: 35
+ width: 35,
+ left: leftovt
}, "fast", "linear", function () {
$this.removeClass("ui-corner-top").addClass("ui-corner-all");
$ovToggleButton.addClass("ui-icon-triangle-1-e").removeClass("ui-icon-triangle-1-w");
@@ -120,8 +261,15 @@
//
// Show
//
+ if (overviewToggle_position != 'false' && overviewToggle_position != false){
+ var leftovt = mapframeLeft + mapframeWidth - overviewInitialWidth;
+ }else{
+ var leftovt = overviewLeft;
+ }
+
$this.animate({
- width: overviewInitialWidth
+ width: overviewInitialWidth,
+ left: leftovt
}, "fast", "linear", function () {
$ov.css({
display: "block",
@@ -142,4 +290,4 @@
});
}
});
-});
+};
More information about the Mapbender_commits
mailing list