Skip to content

Commit

Permalink
v1.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
www committed Oct 26, 2015
2 parents 00413aa + 678b92c commit e082fd4
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 23 deletions.
27 changes: 21 additions & 6 deletions dist/angular-openlayers-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,9 @@ angular.module('openlayers-directive').directive('olMarker', ["$log", "$q", "olM
coord = coord.map(function(v) {
return parseInt(v, 10);
});
} else {
coord = ol.proj.transform(coord, proj, 'EPSG:4326');
}
coord = ol.proj.transform(coord, proj, 'EPSG:4326');

if (evt.type === 'pointerdown') {
// Get feature under mouse if any
Expand All @@ -788,7 +789,11 @@ angular.module('openlayers-directive').directive('olMarker', ["$log", "$q", "olM
return;
}
map.getTarget().style.cursor = 'pointer';
pickOffset = [coord[0] - pickProperties.lon, coord[1] - pickProperties.lat];
if (proj === 'pixel') {
pickOffset = [coord[0] - pickProperties.coord[0], coord[1] - pickProperties.coord[1]];
} else {
pickOffset = [coord[0] - pickProperties.lon, coord[1] - pickProperties.lat];
}
evt.preventDefault();
} else if (pickOffset && pickProperties) {
if (evt.type === 'pointerup') {
Expand All @@ -800,8 +805,13 @@ angular.module('openlayers-directive').directive('olMarker', ["$log", "$q", "olM
evt.preventDefault();
scope.$apply(function() {
// Add current delta to marker initial position
pickProperties.lon = coord[0] - pickOffset[0];
pickProperties.lat = coord[1] - pickOffset[1];
if (proj === 'pixel') {
pickProperties.coord[0] = coord[0] - pickOffset[0];
pickProperties.coord[1] = coord[1] - pickOffset[1];
} else {
pickProperties.lon = coord[0] - pickOffset[0];
pickProperties.lat = coord[1] - pickOffset[1];
}
});
}
}
Expand Down Expand Up @@ -1000,8 +1010,13 @@ angular.module('openlayers-directive').directive('olMarker', ["$log", "$q", "olM
marker.set('marker', properties);
markerLayer.getSource().addFeature(marker);
} else {
var requestedPosition = ol.proj.transform([properties.lon, properties.lat], data.projection,
map.getView().getProjection());
var requestedPosition;
if (properties.projection === 'pixel') {
requestedPosition = properties.coord;
} else {
requestedPosition = ol.proj.transform([properties.lon, properties.lat], data.projection,
map.getView().getProjection());
}

if (!angular.equals(marker.getGeometry().getCoordinates(), requestedPosition)) {
var geometry = new ol.geom.Point(requestedPosition);
Expand Down
4 changes: 2 additions & 2 deletions dist/angular-openlayers-directive.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/angular-openlayers-directive.min.no-header.js

Large diffs are not rendered by default.

27 changes: 21 additions & 6 deletions dist/angular-openlayers-directive.pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,9 @@ angular.module('openlayers-directive').directive('olMarker', function($log, $q,
coord = coord.map(function(v) {
return parseInt(v, 10);
});
} else {
coord = ol.proj.transform(coord, proj, 'EPSG:4326');
}
coord = ol.proj.transform(coord, proj, 'EPSG:4326');

if (evt.type === 'pointerdown') {
// Get feature under mouse if any
Expand All @@ -788,7 +789,11 @@ angular.module('openlayers-directive').directive('olMarker', function($log, $q,
return;
}
map.getTarget().style.cursor = 'pointer';
pickOffset = [coord[0] - pickProperties.lon, coord[1] - pickProperties.lat];
if (proj === 'pixel') {
pickOffset = [coord[0] - pickProperties.coord[0], coord[1] - pickProperties.coord[1]];
} else {
pickOffset = [coord[0] - pickProperties.lon, coord[1] - pickProperties.lat];
}
evt.preventDefault();
} else if (pickOffset && pickProperties) {
if (evt.type === 'pointerup') {
Expand All @@ -800,8 +805,13 @@ angular.module('openlayers-directive').directive('olMarker', function($log, $q,
evt.preventDefault();
scope.$apply(function() {
// Add current delta to marker initial position
pickProperties.lon = coord[0] - pickOffset[0];
pickProperties.lat = coord[1] - pickOffset[1];
if (proj === 'pixel') {
pickProperties.coord[0] = coord[0] - pickOffset[0];
pickProperties.coord[1] = coord[1] - pickOffset[1];
} else {
pickProperties.lon = coord[0] - pickOffset[0];
pickProperties.lat = coord[1] - pickOffset[1];
}
});
}
}
Expand Down Expand Up @@ -1000,8 +1010,13 @@ angular.module('openlayers-directive').directive('olMarker', function($log, $q,
marker.set('marker', properties);
markerLayer.getSource().addFeature(marker);
} else {
var requestedPosition = ol.proj.transform([properties.lon, properties.lat], data.projection,
map.getView().getProjection());
var requestedPosition;
if (properties.projection === 'pixel') {
requestedPosition = properties.coord;
} else {
requestedPosition = ol.proj.transform([properties.lon, properties.lat], data.projection,
map.getView().getProjection());
}

if (!angular.equals(marker.getGeometry().getCoordinates(), requestedPosition)) {
var geometry = new ol.geom.Point(requestedPosition);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"main": "dist/angular-openlayers-directive",
"version": "1.2.2"
"version": "1.2.3"
}
27 changes: 21 additions & 6 deletions src/directives/marker.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ angular.module('openlayers-directive').directive('olMarker', function($log, $q,
coord = coord.map(function(v) {
return parseInt(v, 10);
});
} else {
coord = ol.proj.transform(coord, proj, 'EPSG:4326');
}
coord = ol.proj.transform(coord, proj, 'EPSG:4326');

if (evt.type === 'pointerdown') {
// Get feature under mouse if any
Expand All @@ -124,7 +125,11 @@ angular.module('openlayers-directive').directive('olMarker', function($log, $q,
return;
}
map.getTarget().style.cursor = 'pointer';
pickOffset = [coord[0] - pickProperties.lon, coord[1] - pickProperties.lat];
if (proj === 'pixel') {
pickOffset = [coord[0] - pickProperties.coord[0], coord[1] - pickProperties.coord[1]];
} else {
pickOffset = [coord[0] - pickProperties.lon, coord[1] - pickProperties.lat];
}
evt.preventDefault();
} else if (pickOffset && pickProperties) {
if (evt.type === 'pointerup') {
Expand All @@ -136,8 +141,13 @@ angular.module('openlayers-directive').directive('olMarker', function($log, $q,
evt.preventDefault();
scope.$apply(function() {
// Add current delta to marker initial position
pickProperties.lon = coord[0] - pickOffset[0];
pickProperties.lat = coord[1] - pickOffset[1];
if (proj === 'pixel') {
pickProperties.coord[0] = coord[0] - pickOffset[0];
pickProperties.coord[1] = coord[1] - pickOffset[1];
} else {
pickProperties.lon = coord[0] - pickOffset[0];
pickProperties.lat = coord[1] - pickOffset[1];
}
});
}
}
Expand Down Expand Up @@ -336,8 +346,13 @@ angular.module('openlayers-directive').directive('olMarker', function($log, $q,
marker.set('marker', properties);
markerLayer.getSource().addFeature(marker);
} else {
var requestedPosition = ol.proj.transform([properties.lon, properties.lat], data.projection,
map.getView().getProjection());
var requestedPosition;
if (properties.projection === 'pixel') {
requestedPosition = properties.coord;
} else {
requestedPosition = ol.proj.transform([properties.lon, properties.lat], data.projection,
map.getView().getProjection());
}

if (!angular.equals(marker.getGeometry().getCoordinates(), requestedPosition)) {
var geometry = new ol.geom.Point(requestedPosition);
Expand Down

0 comments on commit e082fd4

Please sign in to comment.