Skip to content

Commit

Permalink
rebuild b2 lib, clean up test page
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanttb committed Oct 4, 2013
1 parent 624d665 commit 375382e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 107 deletions.
8 changes: 4 additions & 4 deletions Gruntfile.js
Expand Up @@ -33,7 +33,7 @@ module.exports = function(grunt) {
'js/jquery.geo.shingled.js'
],
dest: 'dist/jquery.<%= pkg.name %>-<%= pkg.version %>.js'
},
}
},
uglify: {
options: {
Expand All @@ -42,7 +42,7 @@ module.exports = function(grunt) {
dist: {
src: '<%= concat.dist.dest %>',
dest: 'dist/jquery.<%= pkg.name %>-<%= pkg.version %>.min.js'
},
}
},
qunit: {
files: ['test/**/*.html']
Expand All @@ -59,14 +59,14 @@ module.exports = function(grunt) {
jshintrc: '.jshintrc'
},
src: ['js/jquery.geo.core.js', 'js/jquery.geo.geographics.js', 'js/jquery.geo.geomap.js', 'js/jquery.geo.shingled.js', 'js/jquery.geo.tiled.js']
},
}
// test: {
// options: {
// jshintrc: '.jshintrc'
// },
// src: ['test/**/*.js']
// },
},
}
});

// These plugins provide necessary tasks.
Expand Down
23 changes: 12 additions & 11 deletions dist/jquery.geo-1.0.0-b2.js
@@ -1,4 +1,4 @@
/*! jQuery Geo - v1.0.0-b2 - 2013-10-02
/*! jQuery Geo - v1.0.0-b2 - 2013-10-04
* http://jquerygeo.com
* Copyright (c) 2013 Ryan Westphal; Licensed MIT */
// Copyright 2006 Google Inc.
Expand Down Expand Up @@ -3955,8 +3955,8 @@ $.Widget.prototype = {

// create our front & back buffers
// though, at any time either one can be in front
this._$canvasSceneFront = $( window.toStaticHTML( '<img id="scene0" style="-webkit-transform:translateZ(0);' + posCss + sizeCss + '" />' ) ).load($.proxy(this._canvasSceneLoad, this));
this._$canvasSceneBack = $( window.toStaticHTML( '<img id="scene1" style="-webkit-transform:translateZ(0);' + posCss + sizeCss + '" />' ) ).load($.proxy(this._canvasSceneLoad, this));
this._$canvasSceneFront = $( window.toStaticHTML( '<img id="scene0" style="-webkit-transform:translateZ(0);' + posCss + sizeCss + '" />' ) ); //.load($.proxy(this._canvasSceneLoad, this));
this._$canvasSceneBack = $( window.toStaticHTML( '<img id="scene1" style="-webkit-transform:translateZ(0);' + posCss + sizeCss + '" />' ) ); //.load($.proxy(this._canvasSceneLoad, this));

} else if (_ieVersion <= 8) {
this._trueCanvas = false;
Expand Down Expand Up @@ -4251,9 +4251,10 @@ $.Widget.prototype = {
if ( this._trueCanvas ) {
if ( this._options.doubleBuffer && this._trueDoubleBuffer ) {

var geographics = this;

if ( this._requireFlip ) {
var geographics = this;
geographics._requireFlip = false;

var oldCanvasScene = geographics._$canvasSceneFront;

Expand All @@ -4265,8 +4266,6 @@ $.Widget.prototype = {
} ).prop( "src", geographics._$canvas[ 0 ].toDataURL( ) ).prependTo( geographics._$elem );

geographics._$canvasSceneBack = oldCanvasScene.prop( "src", "" ).detach();

geographics._requireFlip = false;
}

// transform a finished scene, can assume no drawing during these calls
Expand Down Expand Up @@ -4319,6 +4318,7 @@ $.Widget.prototype = {

if ( geographics._trueCanvas && geographics._options.doubleBuffer && geographics._trueDoubleBuffer ) {
geographics._$canvasSceneBack.prop( "src", geographics._$canvas[ 0 ].toDataURL( ) );
this._canvasSceneLoad( );
}


Expand Down Expand Up @@ -4417,7 +4417,7 @@ $.Widget.prototype = {
}(jQuery, window));


(function ($, window, undefined) {
(function ($, window, undefined) {
var _widgetIdSeed = 0,
_ieVersion = ( function () {
var v = 5, div = document.createElement("div"), a = div.all || [];
Expand Down Expand Up @@ -4621,8 +4621,8 @@ $.Widget.prototype = {
this._isTap =
this._isDbltap = false;

this._anchor = [ 0, 0 ];
this._current = [ 0, 0 ];
this._anchor = [ 0, 0 ]; /* mouse down */
this._current = [ 0, 0 ]; /* mouse move no matter what */
this._lastMove = [ 0, 0 ];
this._lastDrag = [ 0, 0 ];
this._velocity = [ 0, 0 ];
Expand Down Expand Up @@ -6238,13 +6238,14 @@ $.Widget.prototype = {
}

if (current[0] === this._lastMove[0] && current[1] === this._lastMove[1]) {
e.preventDefault();
if ( this._inOp ) {
e.preventDefault();
if ( doInteractiveTimeout ) {
this._setInteractiveTimeout( true );
}
return false;
}
// fixes: [bug] highlight pop
return false;
}

if ( _ieVersion === 7 ) {
Expand Down
8 changes: 4 additions & 4 deletions dist/jquery.geo-1.0.0-b2.min.js

Large diffs are not rendered by default.

95 changes: 7 additions & 88 deletions docs/examples/test.html
Expand Up @@ -18,24 +18,10 @@
left: 0;
}

#info {
background: #fafafa;
border-radius: .5em;
box-shadow: .2em .2em .4em #222;
font-size: .8em;
max-width: 66%;
padding: .25em .5em;
position: absolute;
left: 1em;
top: 1em;
}


</style>
</head>
<body>
<div id="map">
<div id="info">Browse to <a href="http://www.google.com">google.com</a> and then click back.</div>
</div>

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
Expand All @@ -52,80 +38,13 @@
<!--<script src="../../dist/jquery.geo-1.0.0-test.min.js"></script>-->

<script>
$(function() {
var hover = null;

// create a map
var map = $("#map").geomap({
services: [
{
id: 'map-countries-service',
type: 'shingled',
src: ""
},
{
id: 'map-highlight-service',
type: 'shingled',
src: ""
}
],
center: [ 0, 20 ],
zoom: 2,
cursors: {
click: 'pointer'
},
move: function( e, geo ) {
var countries = map.geomap( 'find', geo, 1 );
if ( countries.length > 0 ) {
map.geomap( 'option', 'mode', 'click' );

if ( !hover || countries[ 0 ] !== hover ) { //.properties.name !== hover.properties.name ) {
if ( hover ) {
mapHighlightService.geomap( 'remove', hover, false );
}

hover = countries[ 0 ]; // $.extend( true, { }, countries[ 0 ] );
console.log("move - append " + hover.properties.name);
mapHighlightService.geomap( 'append', hover );
}

} else {
map.geomap( 'option', 'mode', 'pan' );

if ( hover ) {
mapHighlightService.geomap( 'remove', hover );
hover = null;
}
}
}
});

var mapCountriesService = $( '#map-countries-service' ).geomap( 'option', 'shapeStyle', {
color: '#36484a',
fillOpacity: 1,
stroke: '#addfe6',
strokeWidth: '1px'
} );
var mapHighlightService = $( '#map-highlight-service' ).geomap( 'option', 'shapeStyle', {
fillOpacity: 0,
stroke: '#aaa04e',
strokeWidth: '2px'
} );

// grab the world countries file
$.getJSON('http://data.jquerygeo.com/ne_110m_land.geojson', function (result) {
// append them to the map
$.each( result.features, function( ) {
mapCountriesService.geomap('append', this, {
color: '#36484a'
}, false);
});

// show them
map.geomap('refresh');
});
});

$( function() {
// create a map
var map = $( '#map' ).geomap( {
center: [ -71.3595678, 42.3604823 ],
zoom: 8
} );
} );
</script>
</body>
</html>

0 comments on commit 375382e

Please sign in to comment.