Skip to content

Commit

Permalink
Merge pull request #89 from Logicify/development
Browse files Browse the repository at this point in the history
Released version v0.1.15
  • Loading branch information
corvis authored Sep 26, 2016
2 parents d717c60 + 3f46656 commit 648dc1f
Show file tree
Hide file tree
Showing 15 changed files with 253 additions and 30 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules
.idea
6 changes: 4 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ module.exports = function (grunt) {
sourceMap: true
},
files: {
'<%= appConfig.dist %>/locationpicker.jquery.min.js': ['<%= appConfig.app %>/*.js']
'<%= appConfig.dist %>/locationpicker.jquery.min.js': ['<%= appConfig.app %>/locationpicker.jquery.js'],
'<%= appConfig.dist %>/angularLocationpicker.jquery.min.js': ['<%= appConfig.app %>/angularLocationpicker.jquery.js']
}
},
beautify: {
Expand All @@ -52,7 +53,8 @@ module.exports = function (grunt) {
mangle: false
},
files: {
'<%= appConfig.dist %>/locationpicker.jquery.js': ['<%= appConfig.app %>/*.js']
'<%= appConfig.dist %>/locationpicker.jquery.js': ['<%= appConfig.app %>/locationpicker.jquery.js'],
'<%= appConfig.dist %>/angularLocationpicker.jquery.js': ['<%= appConfig.app %>/angularLocationpicker.jquery.js']
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Documentation along with examples available [here](http://logicify.github.io/jqu

Credits
-------
Dmitry Berezovsky, Logicify (<http://logicify.com/>)
Emanuele Coppola, Libre sc (<http://libreidee.com/>)
* Dmitry Berezovsky, Logicify (<http://logicify.com/>)
* Gennadiy Varava, Logicify (<http://logicify.com/>)
* Emanuele Coppola, Libre sc (<http://libreidee.com/>)

4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jquery-locationpicker",
"version": "0.1.14",
"name": "jquery-locationpicker-plugin",
"version": "0.1.15",
"homepage": "https://github.com/Logicify/jquery-locationpicker-plugin",
"authors": [
"Dmitry Berezovsky <[email protected]>"
Expand Down
48 changes: 48 additions & 0 deletions dist/angularLocationpicker.jquery.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*! jquery-locationpicker - v0.1.15 - 2016-09-26 */
"use strict";

angular.module("angular-jquery-locationpicker", []).constant("angularJQueryLocationpickerDefaultValue", {
css: {
width: "550px",
height: "400px",
"float": "left"
}
}).service("angularJQueryLocationpickerService", [ "angularJQueryLocationpickerDefaultValue", function(defaultValue) {
var service = {};
service.callAutosizeOnInit = function(element, initCb) {
var cb = initCb;
if (!!cb) {
initCb = function() {
$(element).locationpicker("autosize");
cb();
};
} else {
initCb = function() {
$(element).locationpicker("autosize");
};
}
};
service.checkDefaultStyles = function(element) {
var elementStyle = element[0].style;
element.css({
width: elementStyle.width || defaultValue.css.width,
height: elementStyle.height || defaultValue.css.height,
"float": elementStyle.float || defaultValue.css.float,
overflow: "hidden"
});
};
return service;
} ]).directive("locationpicker", [ "angularJQueryLocationpickerService", function(service) {
return {
restrict: "EA",
replace: true,
scope: {
options: "="
},
link: function(scope, element, attrs) {
service.checkDefaultStyles(element);
service.callAutosizeOnInit(element, scope.options.oninitialized);
$(element).locationpicker(scope.options);
}
};
} ]);
4 changes: 4 additions & 0 deletions dist/angularLocationpicker.jquery.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/angularLocationpicker.jquery.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 17 additions & 9 deletions dist/locationpicker.jquery.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! jquery-locationpicker - v0.1.14 - 2016-09-20 */
/*! jquery-locationpicker - v0.1.15 - 2016-09-26 */
(function($) {
function GMapContext(domElement, options) {
var _map = new google.maps.Map(domElement, options);
Expand Down Expand Up @@ -91,6 +91,10 @@
var address = GmUtility.addressByFormat(results, gmapContext.settings.addressFormat);
gmapContext.locationName = address.formatted_address;
gmapContext.addressComponents = GmUtility.address_component_from_google_geocode(address.address_components);
} else if (status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT) {
return setTimeout(function() {
GmUtility.updateLocationName(gmapContext, callback);
}, 1e3);
}
if (callback) {
callback.call(this, gmapContext);
Expand Down Expand Up @@ -148,10 +152,11 @@
if (inputBinding) {
if (inputBinding.radiusInput) {
inputBinding.radiusInput.on("change", function(e) {
if (!e.originalEvent) {
var radiusInputValue = $(this).val();
if (!e.originalEvent || isNaN(radiusInputValue)) {
return;
}
gmapContext.radius = $(this).val();
gmapContext.radius = radiusInputValue;
GmUtility.setPosition(gmapContext, gmapContext.location, function(context) {
context.settings.onchanged.apply(gmapContext.domContainer, [ GmUtility.locationFromLatLng(context.location), context.radius, false ]);
});
Expand Down Expand Up @@ -204,21 +209,23 @@
}
if (inputBinding.latitudeInput) {
inputBinding.latitudeInput.on("change", function(e) {
if (!e.originalEvent) {
var latitudeInputValue = $(this).val();
if (!e.originalEvent || isNaN(latitudeInputValue)) {
return;
}
GmUtility.setPosition(gmapContext, new google.maps.LatLng($(this).val(), gmapContext.location.lng()), function(context) {
GmUtility.setPosition(gmapContext, new google.maps.LatLng(latitudeInputValue, gmapContext.location.lng()), function(context) {
context.settings.onchanged.apply(gmapContext.domContainer, [ GmUtility.locationFromLatLng(context.location), context.radius, false ]);
updateInputValues(gmapContext.settings.inputBinding, gmapContext);
});
});
}
if (inputBinding.longitudeInput) {
inputBinding.longitudeInput.on("change", function(e) {
if (!e.originalEvent) {
var longitudeInputValue = $(this).val();
if (!e.originalEvent || isNaN(longitudeInputValue)) {
return;
}
GmUtility.setPosition(gmapContext, new google.maps.LatLng(gmapContext.location.lat(), $(this).val()), function(context) {
GmUtility.setPosition(gmapContext, new google.maps.LatLng(gmapContext.location.lat(), longitudeInputValue), function(context) {
context.settings.onchanged.apply(gmapContext.domContainer, [ GmUtility.locationFromLatLng(context.location), context.radius, false ]);
updateInputValues(gmapContext.settings.inputBinding, gmapContext);
});
Expand Down Expand Up @@ -306,7 +313,7 @@
return;
}
var settings = $.extend({}, $.fn.locationpicker.defaults, options);
var gmapContext = new GMapContext(this, {
var gmapContext = new GMapContext(this, $.extend({}, settings.mapOptions, {
zoom: settings.zoom,
center: new google.maps.LatLng(settings.location.latitude, settings.location.longitude),
mapTypeId: settings.mapTypeId,
Expand All @@ -324,7 +331,7 @@
markerIcon: settings.markerIcon,
markerDraggable: settings.markerDraggable,
markerVisible: settings.markerVisible
});
}));
$target.data("locationpicker", gmapContext);
function displayMarkerWithSelectedArea() {
GmUtility.setPosition(gmapContext, gmapContext.marker.position, function(context) {
Expand Down Expand Up @@ -369,6 +376,7 @@
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP,
styles: [],
mapOptions: {},
scrollwheel: true,
inputBinding: {
latitudeInput: null,
Expand Down
Loading

0 comments on commit 648dc1f

Please sign in to comment.