Skip to content

Commit

Permalink
1. Updated LICENSE path in packaged dist files
Browse files Browse the repository at this point in the history
2. Fixed bugs in labels and pins where mouse events were not passing through to clickable region
3. Removed -merc suffix from map files created by map creator ( fixes #204 )
4. Added new example for custom placement of pins `./examples/pins_custom.html`
5. Fixed `onRegionSelect` issue not returning region ( fixes #201 )
6. Added better support to make regions disabled ( see #197 and new `./examples/inactive_regions.html` )
  • Loading branch information
manifestinteractive committed Mar 16, 2016
1 parent 0bd9973 commit 9aed870
Show file tree
Hide file tree
Showing 26 changed files with 167 additions and 36 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jqvmap",
"version": "1.4.0",
"version": "1.5.0",
"homepage": "http://jqvmap.com",
"authors": [
"JQVMap"
Expand Down
2 changes: 1 addition & 1 deletion create/jqvmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def addPath(self, path, code, name):
def getJSCode(self):
map = {"paths": self.paths, "width": self.width, "height": self.height, "insets": self.insets, "projection": self.projection}
header = "/** JQVMap " + self.projection['type'] + " map for " + self.name + " */"
js = "jQuery.fn.vectorMap('addMap', '" + self.name + "-" + self.projection['type'] + "'," + json.dumps(map) + ");"
js = "jQuery.fn.vectorMap('addMap', '" + self.name + "'," + json.dumps(map) + ");"
return header + "\n" + js


Expand Down
18 changes: 9 additions & 9 deletions dist/jquery.vmap.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*!
* JQVMap: jQuery Vector Map Library
* @author JQVMap
* @version 1.4.0
* @author JQVMap <me@peterschmalfeldt.com>
* @version 1.5.0
* @link http://jqvmap.com
* @license https://raw.githubusercontent.com/manifestinteractive/jqvmap/master/LICENSE
* @license https://github.com/manifestinteractive/jqvmap/blob/master/LICENSE
* @builddate 2016/03/15
*/

Expand Down Expand Up @@ -114,7 +114,7 @@ var JQVMap = function (params) {
jQuery(params.container).trigger(resizeEvent, [newWidth, newHeight]);

if(mapPins){
jQuery('.jqvmap_pin').remove();
jQuery('.jqvmap-pin').remove();
map.pinHandlers = false;
map.placePins(mapPins.pins, mapPins.mode);
}
Expand Down Expand Up @@ -606,7 +606,7 @@ JQVMap.prototype.getPinId = function (cc) {
};

JQVMap.prototype.getPins = function(){
var pins = this.container.find('.jqvmap_pin');
var pins = this.container.find('.jqvmap-pin');
var ret = {};
jQuery.each(pins, function(index, pinObj){
pinObj = jQuery(pinObj);
Expand Down Expand Up @@ -812,7 +812,7 @@ JQVMap.prototype.placePins = function(pins, pinMode){
if($pin.length > 0){
$pin.remove();
}
map.container.append('<div id="' + pinIndex + '" for="' + index + '" class="jqvmap_pin" style="position:absolute">' + pin + '</div>');
map.container.append('<div id="' + pinIndex + '" for="' + index + '" class="jqvmap-pin" style="position:absolute">' + pin + '</div>');
});
} else { //treat pin as id of an html content
jQuery.each(pins, function(index, pin){
Expand All @@ -824,7 +824,7 @@ JQVMap.prototype.placePins = function(pins, pinMode){
if($pin.length > 0){
$pin.remove();
}
map.container.append('<div id="' + pinIndex + '" for="' + index + '" class="jqvmap_pin" style="position:absolute"></div>');
map.container.append('<div id="' + pinIndex + '" for="' + index + '" class="jqvmap-pin" style="position:absolute"></div>');
$pin.append(jQuery('#' + pin));
});
}
Expand All @@ -843,7 +843,7 @@ JQVMap.prototype.placePins = function(pins, pinMode){

JQVMap.prototype.positionPins = function(){
var map = this;
var pins = this.container.find('.jqvmap_pin');
var pins = this.container.find('.jqvmap-pin');
jQuery.each(pins, function(index, pinObj){
pinObj = jQuery(pinObj);
var countryId = map.getCountryId(pinObj.attr('for').toLowerCase());
Expand All @@ -867,7 +867,7 @@ JQVMap.prototype.removePin = function(cc) {
};

JQVMap.prototype.removePins = function(){
this.container.find('.jqvmap_pin').remove();
this.container.find('.jqvmap-pin').remove();
};

JQVMap.prototype.reset = function () {
Expand Down
9 changes: 4 additions & 5 deletions dist/jquery.vmap.min.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions dist/jqvmap.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
font-family: sans-serif, Verdana;
font-size: smaller;
padding: 3px;
pointer-events:none;
}
.jqvmap-pin {
pointer-events:none;
}
.jqvmap-zoomin, .jqvmap-zoomout
{
Expand Down
Binary file added examples/images/marker/black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/marker/blue.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/marker/green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/marker/grey.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/marker/orange.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/marker/purple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/marker/red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/marker/white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/images/marker/yellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 7 additions & 6 deletions examples/labels.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@
}

/* Setup basic CSS for Label */
.jqvmap_pin {
.jqvmap-pin {
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
cursor: default;
pointer-events: none;
}

/* Hide Whichever Labels you want */
Expand Down Expand Up @@ -95,31 +96,31 @@
/* Add responsibe support to resize labels for difference screen sizes */

@media only screen and (min-width: 320px) {
.jqvmap_pin {
.jqvmap-pin {
font-size: 6px;
}
}

@media only screen and (min-width: 480px) {
.jqvmap_pin {
.jqvmap-pin {
font-size: 8px;
}
}

@media only screen and (min-width: 640px) {
.jqvmap_pin {
.jqvmap-pin {
font-size: 10px;
}
}

@media only screen and (min-width: 800px) {
.jqvmap_pin {
.jqvmap-pin {
font-size: 12px;
}
}

@media only screen and (min-width: 1024px) {
.jqvmap_pin {
.jqvmap-pin {
font-size: 14px;
}
}
Expand Down
1 change: 1 addition & 0 deletions examples/pins.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
height: 5px;
position: absolute;
cursor: pointer;
pointer-events: none;
}

.pin .pin_content {
Expand Down
127 changes: 127 additions & 0 deletions examples/pins_custom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>JQVMap - USA Map</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">

<!-- Mobile Specific Meta Tags -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">

<link href="../dist/jqvmap.css" media="screen" rel="stylesheet" type="text/css"/>

<style>
html, body {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
}
#vmap {
width: 100%;
height: 100%;
background-color: #333;
-webkit-tap-highlight-color: rgba(0,0,0,0);
}

.jqvmap-region {
cursor: default !important;
}

.map-pin {
width: 64px;
height: 50px;
position: absolute;
top: -25px;
left: -32px;
background-size: 32px 32px;
background-repeat: no-repeat;
text-align: center;
background-position: top center;
color: #888;
font-weight: 500;
font-size: 14px;
}

.map-pin span {
position: absolute;
bottom: 0;
width: 100%;
text-align: center;
left: 0;
}

.red {
background-image: url('images/marker/red.png');
}

.blue {
background-image: url('images/marker/blue.png');
}

.purple {
background-image: url('images/marker/purple.png');
}

/* Setup basic CSS for Label */
.jqvmap-pin {
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
cursor: default;
}

/* Reposition Labels that are not quite right ( labels are centered in shape, and sometimes need tweaking ) */

#jqvmap1_fl_pin {
margin-left: 5%;
}

</style>

<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="../dist/jquery.vmap.js"></script>
<script type="text/javascript" src="../dist/maps/jquery.vmap.usa.js" charset="utf-8"></script>

<script>

function escapeXml(string) {
return string.replace(/[<>]/g, function (c) {
switch (c) {
case '<': return '\u003c';
case '>': return '\u003e';
}
});
}

jQuery(document).ready(function () {

var pins = {
mo: escapeXml('<div class="map-pin red"><span>MO</span></div>'),
fl: escapeXml('<div class="map-pin blue"><span>FL</span></div>'),
or: escapeXml('<div class="map-pin purple"><span>OR</span></div>')
};

jQuery('#vmap').vectorMap({
backgroundColor: '#333',
borderColor: '#333',
map: 'usa_en',
pins: pins,
color: '#fff',
pinMode: 'content',
hoverColor: null,
selectedColor: '#111',
showTooltip: false,
selectedRegions: ['MO', 'FL', 'OR'],
onRegionClick: function(event){
event.preventDefault();
}
});

});
</script>
</head>
<body>
<div id="vmap"></div>
</body>
</html>
4 changes: 2 additions & 2 deletions grunt/concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ module.exports = {
options: {
banner: '/*!\n' +
' * <%= package.author.name %>: <%= package.description %>\n' +
' * @author <%= package.author.name %>\n' +
' * @author <%= package.author.name %> <<%= package.author.email %>>\n' +
' * @version <%= package.version %>\n' +
' * @link <%= package.author.url %>\n' +
' * @license https://raw.githubusercontent.com/manifestinteractive/jqvmap/master/LICENSE\n' +
' * @license https://github.com/manifestinteractive/jqvmap/blob/master/LICENSE\n' +
' * @builddate <%= grunt.template.today("yyyy/mm/dd") %>\n' +
' */\n\n'
},
Expand Down
5 changes: 2 additions & 3 deletions grunt/uglify.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ module.exports = {
options: {
banner: '/*!\n' +
' * <%= package.author.name %>: <%= package.description %>\n' +
' * @author <%= package.author.email %>\n' +
' * @author <%= package.author.name %> <<%= package.author.email %>>\n' +
' * @version <%= package.version %>\n' +
' * @link <%= package.author.url %>\n' +
' * @license Unauthorized copying of this file, via any medium is strictly prohibited.\n' +
' * This file cannot be copied and/or distributed without express written consent from @author.\n' +
' * @license https://github.com/manifestinteractive/jqvmap/blob/master/LICENSE\n' +
' * @builddate <%= grunt.template.today("yyyy/mm/dd") %>\n' +
' */\n\n'
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jqvmap",
"version": "1.4.0",
"version": "1.5.0",
"homepage": "http://jqvmap.com",
"author": {
"name": "JQVMap",
Expand Down
2 changes: 1 addition & 1 deletion src/JQVMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var JQVMap = function (params) {
jQuery(params.container).trigger(resizeEvent, [newWidth, newHeight]);

if(mapPins){
jQuery('.jqvmap_pin').remove();
jQuery('.jqvmap-pin').remove();
map.pinHandlers = false;
map.placePins(mapPins.pins, mapPins.mode);
}
Expand Down
2 changes: 1 addition & 1 deletion src/JQVMap/getPins.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
JQVMap.prototype.getPins = function(){
var pins = this.container.find('.jqvmap_pin');
var pins = this.container.find('.jqvmap-pin');
var ret = {};
jQuery.each(pins, function(index, pinObj){
pinObj = jQuery(pinObj);
Expand Down
4 changes: 2 additions & 2 deletions src/JQVMap/placePins.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ JQVMap.prototype.placePins = function(pins, pinMode){
if($pin.length > 0){
$pin.remove();
}
map.container.append('<div id="' + pinIndex + '" for="' + index + '" class="jqvmap_pin" style="position:absolute">' + pin + '</div>');
map.container.append('<div id="' + pinIndex + '" for="' + index + '" class="jqvmap-pin" style="position:absolute">' + pin + '</div>');
});
} else { //treat pin as id of an html content
jQuery.each(pins, function(index, pin){
Expand All @@ -28,7 +28,7 @@ JQVMap.prototype.placePins = function(pins, pinMode){
if($pin.length > 0){
$pin.remove();
}
map.container.append('<div id="' + pinIndex + '" for="' + index + '" class="jqvmap_pin" style="position:absolute"></div>');
map.container.append('<div id="' + pinIndex + '" for="' + index + '" class="jqvmap-pin" style="position:absolute"></div>');
$pin.append(jQuery('#' + pin));
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/JQVMap/positionPins.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
JQVMap.prototype.positionPins = function(){
var map = this;
var pins = this.container.find('.jqvmap_pin');
var pins = this.container.find('.jqvmap-pin');
jQuery.each(pins, function(index, pinObj){
pinObj = jQuery(pinObj);
var countryId = map.getCountryId(pinObj.attr('for').toLowerCase());
Expand Down
2 changes: 1 addition & 1 deletion src/JQVMap/removePins.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
JQVMap.prototype.removePins = function(){
this.container.find('.jqvmap_pin').remove();
this.container.find('.jqvmap-pin').remove();
};
4 changes: 2 additions & 2 deletions tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ test("Test labels show up", function () {
showLabels: true
});

var labelsExist = (jQuery('.jqvmap_pin').length > 0);
var labelsExist = (jQuery('.jqvmap-pin').length > 0);

equal(labelsExist, 1, 'vectorMap({ showLabels: true }) set correctly and label showing');

jQuery('.jqvmap_pin').remove();
jQuery('.jqvmap-pin').remove();
$container.html('');
});

Expand Down

0 comments on commit 9aed870

Please sign in to comment.