[Opengeoscience-developers] OpenGeoscience branch, map_fixes, updated. 40bd8d06338b9f596045e9e17a39055bf56ccfa5
Aashish Chaudhary
aashish.chaudhary at kitware.com
Wed Mar 6 18:52:04 EST 2013
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "OpenGeoscience".
The branch, map_fixes has been updated
via 40bd8d06338b9f596045e9e17a39055bf56ccfa5 (commit)
from 7f91ee4b8ddb7d89f2ea7bcc49923ae436e8bc69 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://public.kitware.com/gitweb?p=OpenGeoscience/opengeoscience.git;a=commitdiff;h=40bd8d06338b9f596045e9e17a39055bf56ccfa5
commit 40bd8d06338b9f596045e9e17a39055bf56ccfa5
Author: Aashish Chaudhary <aashish.chaudhary at kitware.com>
AuthorDate: Wed Mar 6 18:51:37 2013 -0500
Commit: Aashish Chaudhary <aashish.chaudhary at kitware.com>
CommitDate: Wed Mar 6 18:51:47 2013 -0500
Resize canvas appropriately
diff --git a/web/index.html b/web/index.html
index 09cd350..059c64f 100644
--- a/web/index.html
+++ b/web/index.html
@@ -13,7 +13,6 @@
<script>
$(function() {
$( "#slider-vertical" ).slider({
- orientation: "vertical",
range: "min",
min: 0.0,
max: 1.0,
@@ -28,6 +27,7 @@
</head>
<body onload="main()">
<canvas id="glcanvas" width="800" height="600"></canvas>
- <div id="slider-vertical" style="height: 600px; display: inline-block;"></div>
+ <p>Opacity</p>
+ <div id="slider-vertical" style="width:20%;height:1%;"></div>
</body>
</html>
diff --git a/web/lib/app.js b/web/lib/app.js
index eca78c0..d627843 100644
--- a/web/lib/app.js
+++ b/web/lib/app.js
@@ -45,4 +45,28 @@ function main() {
planeLayer.setOpacity(ui.value);
myMap.redraw();
});
+
+ (function() {
+ var canvas = document.getElementById('glcanvas');
+
+ // resize the canvas to fill browser window dynamically
+ window.addEventListener('resize', resizeCanvas, false);
+
+ function resizeCanvas() {
+ canvas.width = window.innerWidth;
+ canvas.height = window.innerHeight * 0.85;
+
+ /**
+ * Your drawings need to be inside this function otherwise they will be reset when
+ * you resize the browser window and the canvas goes will be cleared.
+ */
+ updateAndDraw(canvas.width, canvas.height);
+ }
+ resizeCanvas();
+
+ function updateAndDraw(width, height) {
+ myMap.resize(width, height);
+ myMap.redraw();
+ }
+ })();
}
diff --git a/web/lib/geo/map.js b/web/lib/geo/map.js
index abfdeca..8b7749b 100644
--- a/web/lib/geo/map.js
+++ b/web/lib/geo/map.js
@@ -362,5 +362,13 @@ geoModule.map = function(node, options) {
m_renderer.render();
};
+ /**
+ * Resize the maps
+ *
+ */
+ this.resize = function(width, height) {
+ m_renderer.resize(width, height);
+ };
+
return this;
};
-----------------------------------------------------------------------
Summary of changes:
web/index.html | 4 ++--
web/lib/app.js | 24 ++++++++++++++++++++++++
web/lib/geo/map.js | 8 ++++++++
3 files changed, 34 insertions(+), 2 deletions(-)
hooks/post-receive
--
OpenGeoscience
More information about the Opengeoscience-developers
mailing list