Skip to content

Commit

Permalink
Tweaking mobile control resolution work
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Oct 4, 2011
1 parent 4b7a814 commit e99ff67
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
4 changes: 2 additions & 2 deletions control/mm/interaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ wax.mm.interaction = function(map, tilejson, options) {
if (feature && _af !== feature) {
_af = feature;
callbacks.out(map.parent);
callbacks.over(feature, map.parent);
callbacks.over(feature, map.parent, e);
} else if (!feature) {
_af = null;
callbacks.out(map.parent);
Expand Down Expand Up @@ -200,7 +200,7 @@ wax.mm.interaction = function(map, tilejson, options) {
case 'full':
// clickAction can be teaser in touch interaction
case 'teaser':
return callbacks.click(feature, map.parent, 0, e);
return callbacks.click(feature, map.parent, e);
case 'location':
return clickHandler(feature);
}
Expand Down
36 changes: 14 additions & 22 deletions control/mm/mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,6 @@ wax.mm.mobile = function(map, tilejson, opts) {
ctx.fillStyle = inactive;
ctx.fillRect(0, 0, width, height);

ctx.fillStyle = 'rgb(255, 255, 255)';
ctx.strokeStyle = 'rgb(255, 255, 255)';
ctx.lineWidth = 5;
ctx.beginPath();
ctx.moveTo(w2 - size * 0.8, h2 - size); // give the (x,y) coordinates
ctx.lineTo(w2 - size * 0.8, h2 + size);
ctx.lineTo(w2 + size * 0.8, h2);
ctx.fill();

ctx.beginPath();
ctx.arc(
w2 - size * 0.3,
Expand All @@ -54,26 +45,27 @@ wax.mm.mobile = function(map, tilejson, opts) {
Math.PI * 2,
true);
ctx.closePath();
ctx.stroke();
ctx.fillStyle = 'rgb(100, 100, 100)';
ctx.fill();

ctx.fillStyle = 'rgb(255, 255, 255)';
ctx.lineWidth = 5;
ctx.beginPath();
ctx.moveTo(w2 - size * 0.8, h2 - size); // give the (x,y) coordinates
ctx.lineTo(w2 - size * 0.8, h2 + size);
ctx.lineTo(w2 + size * 0.8, h2);
ctx.fill();

// Done! Now fill the shape, and draw the stroke.
// Note: your shape will not be visible until you call any of the two methods.
div.appendChild(canvas);
};

// Adapted from code by Mislav Marohnić: http://gist.github.com/355625
function getDeviceScale() {
var deviceWidth, landscape = Math.abs(window.orientation) == 90;

if (landscape) {
// iPhone OS < 3.2 reports a screen height of 396px
deviceWidth = Math.max(480, screen.height);
} else {
deviceWidth = screen.width;
}

// return window.innerWidth / deviceWidth;
return deviceWidth / window.innerWidth;
return ((Math.abs(window.orientation) == 90) ?
Math.max(480, screen.height) :
screen.width) /
window.innerWidth;
}

var defaultBackDraw = function(div) {
Expand Down

0 comments on commit e99ff67

Please sign in to comment.