[Mapbender-commits] r8582 - branches/2.7/http/javascripts
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Mar 12 08:15:28 PDT 2013
Author: astrid_emde
Date: 2013-03-12 08:15:27 -0700 (Tue, 12 Mar 2013)
New Revision: 8582
Modified:
branches/2.7/http/javascripts/mod_resize_mapsize.js
Log:
new element vars: max_height and max_width - set size in pixel or false
http://trac.osgeo.org/mapbender/ticket/892
Modified: branches/2.7/http/javascripts/mod_resize_mapsize.js
===================================================================
--- branches/2.7/http/javascripts/mod_resize_mapsize.js 2013-03-12 10:27:53 UTC (rev 8581)
+++ branches/2.7/http/javascripts/mod_resize_mapsize.js 2013-03-12 15:15:27 UTC (rev 8582)
@@ -24,14 +24,22 @@
* > 'var');
* >
* > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value,
- * > context, var_type) VALUES('gui1', 'resizeMapsize', 'adjust_width', '-45',
+ * > context, var_type) VALUES('<gui_id>', 'resizeMapsize', 'adjust_width', '-45',
* > 'to adjust the width of the mapframe on the right side of the window',
* > 'var');
* >
* > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value,
- * > context, var_type) VALUES('gui1', 'resizeMapsize', 'resize_option',
+ * > context, var_type) VALUES('<gui_id>', 'resizeMapsize', 'resize_option',
* > 'button', 'auto (autoresize on load), button (resize by button)' ,'var');
*
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value,
+ * > context, var_type) VALUES('<gui_id>', 'resizeMapsize', 'max_height',
+ * > '700', 'define a max mapframe width (units pixel) f.e. 700 or false' ,'var');
+ *
+ * > INSERT INTO gui_element_vars(fkey_gui_id, fkey_e_id, var_name, var_value,
+ * > context, var_type) VALUES('<gui_id>', 'resizeMapsize', 'max_width',
+ * > '700', 'define a max mapframe width (units pixel) f.e. 700 or false' ,'var');
+ *
* Help:
* http://www.mapbender.org/ResizeMapsize
*
@@ -77,6 +85,16 @@
}
var adjust_height = options.adjust_height;
+if (typeof options.max_width == "undefined") {
+ options.max_width = false;
+}
+var max_width = options.max_width;
+
+if (typeof options.max_height === "undefined") {
+ options.max_height = false;
+}
+var max_height = options.max_height;
+
var map;
var mapExtent;
var map_frame = options.target;
@@ -99,8 +117,27 @@
function adjustDimension(skipMapRequest) {
var currentScale = map.getScale();
- var mapheight = frameHeight() - parseInt(map.getDomElement().style.top, 10) + adjust_height;
- var mapwidth = frameWidth() - map_frame_left - legend_width + adjust_width;
+ var newFrameHeight = frameHeight();
+ var newFrameWidth = frameWidth();
+
+ if (max_height !== false){
+ if (newFrameHeight > (max_height + parseInt(map.getDomElement().style.top, 10) - adjust_height)){
+ var mapheight = max_height;
+ }else{
+ var mapheight = newFrameHeight - parseInt(map.getDomElement().style.top, 10) + adjust_height;
+ }
+ }
+
+ if (max_width !== false){
+ if (newFrameWidth > max_width + legend_width - adjust_width){
+ var mapwidth = max_width;
+ }else{
+ var mapwidth = newFrameWidth - map_frame_left - legend_width + adjust_width;
+ }
+ }
+
+ //var mapheight = newFrameHeight - parseInt(map.getDomElement().style.top, 10) + adjust_height;
+ //var mapwidth = newFrameWidth - map_frame_left - legend_width + adjust_width;
map.setWidth(mapwidth);
map.setHeight(mapheight);
More information about the Mapbender_commits
mailing list