Permalink
Browse files

Merge pull request #228 from Gizra/227

Add position, size, style and zoom configuration according devices.
  • Loading branch information...
2 parents 13aac29 + 1e9efa5 commit 86040a251a5c770eb4135f4b0650738181bdc698 @ceoaliongroo ceoaliongroo committed Feb 18, 2014
Showing with 47 additions and 2 deletions.
  1. +8 −0 app/_scss/fixes.css
  2. +35 −2 app/js/cdl.js
  3. +4 −0 app/js/config.js
View
@@ -19,4 +19,12 @@
}
+@media only screen
+and (min-device-width : 768px)
+and (max-device-width : 1024px)
+and (-webkit-min-device-pixel-ratio: 1) {
+ iframe.iframe {
+ height: inherit;
+ }
+}
View
@@ -18,8 +18,39 @@
background,
system,
draw = {},
- width = 900,
- height = 600;
+ width = config.chart.canvas.width,
+ height = config.chart.canvas.height,
+ agent = navigator.userAgent;
+
+ // Detect device and set configuration respectively.
+ if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(agent) ) {
+ if (agent.match(/iPad/)) {
+ config.chart.initial.minZoom = 0.43;
+ config.chart.zoom.hideGrandChildren = 0.44;
+ config.chart.initial.y = function(height) { return height * 0.30;};
+ config.nodes.root.r = config.nodes.root.rFocus = config.nodes.root.target = config.nodes.translation.r = config.nodes.translation.rFocus = config.nodes.translation.target = 35;
+ }
+ else if (agent.match(/Android/)) {
+ if (agent.match(/Pad/)) {
+ config.chart.initial.minZoom = 0.65;
+ config.chart.zoom.hideGrandChildren = 0.66;
+ config.chart.initial.y = function(height) { return height * 0.40;};
+ config.nodes.root.r = config.nodes.root.rFocus = config.nodes.root.target = config.nodes.translation.r = config.nodes.translation.rFocus = config.nodes.translation.target = 60 ;
+ }
+ else {
+ config.chart.initial.minZoom = 0.33;
+ config.chart.zoom.hideGrandChildren = 0.34
+ config.chart.initial.y = function(height) { return height * 0.25;};
+ config.nodes.root.r = config.nodes.root.rFocus = config.nodes.root.target = config.nodes.translation.r = config.nodes.translation.rFocus = config.nodes.translation.target = 30 ;
+ }
+ }
+
+ }
+ else {
+ config.chart.initial.minZoom = 0.55;
+ config.chart.zoom.hideGrandChildren = 0.56;
+ config.nodes.root.r = config.nodes.root.rFocus = config.nodes.root.target = config.nodes.translation.r = config.nodes.translation.rFocus = config.nodes.translation.target = 50;
+ }
/**
* Create the 'Canvas' area, it's possible define the dimensions.
@@ -30,6 +61,8 @@
function prepareScenario() {
var initialScaleOnZoom;
+ // Define
+
function zoomstart() {
initialScaleOnZoom = draw.getScale();
}
View
@@ -18,6 +18,10 @@
* transitions: Define duration in miliseconds of the transitions, for each kind of elements.
*/
this.chart = {
+ canvas: {
+ width: 900,
+ height: 600
+ },
initial: {
x: function(width) { return -width * 0.03;},
y: function(height) { return height * 0.35;},

0 comments on commit 86040a2

Please sign in to comment.