Skip to content

Commit

Permalink
Merge pull request mapbox#537 from mapbox/fix-534
Browse files Browse the repository at this point in the history
remove truncation from draw
  • Loading branch information
mcwhittemore authored Nov 8, 2016
2 parents bbfd25c + e902343 commit 724e3f8
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 26 deletions.
4 changes: 0 additions & 4 deletions src/lib/mode_handler.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const truncatePoint = require('./truncate_point');

var ModeHandler = function(mode, DrawContext) {

Expand Down Expand Up @@ -29,9 +28,6 @@ var ModeHandler = function(mode, DrawContext) {
};

var delegate = function (eventName, event) {
if (event.lngLat) {
event.lngLat = truncatePoint(event.lngLat);
}
var handles = handlers[eventName];
var iHandle = handles.length;
while (iHandle--) {
Expand Down
5 changes: 2 additions & 3 deletions src/lib/move_features.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const truncatePoint = require('./truncate_point');
const xtend = require('xtend');
const constrainFeatureMovement = require('./constrain_feature_movement');
const Constants = require('../constants');
Expand All @@ -10,10 +9,10 @@ module.exports = function(features, delta) {
const currentCoordinates = feature.getCoordinates();

const moveCoordinate = (coord) => {
let point = truncatePoint({
let point = {
lng: coord[0] + constrainedDelta.lng,
lat: coord[1] + constrainedDelta.lat
});
};
return [point.lng, point.lat];
};
const moveRing = (ring) => ring.map(coord => moveCoordinate(coord));
Expand Down
7 changes: 0 additions & 7 deletions src/lib/truncate_point.js

This file was deleted.

12 changes: 0 additions & 12 deletions test/move_features.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@ test('moveFeatures point', t => {
t.end();
});

test('moveFeatures point and truncate the Position to 6 decimal points', t => {
const point = new Point(mockFeatureContext, getGeoJSON('point'));
point.setCoordinates([10, 20]);
moveFeatures([point], { lng: 50.000000001, lat: 20.000000001 });
t.deepEqual(point.getCoordinates(), [60, 40]);

point.setCoordinates([10, 20]);
moveFeatures([point], { lng: 50.123456789, lat: 20.123456789 });
t.deepEqual(point.getCoordinates(), [60.123456, 40.123456]);
t.end();
});

test('moveFeatures point beyond north limit map', t => {
const point = new Point(mockFeatureContext, getGeoJSON('point'));
point.setCoordinates([10, 20]);
Expand Down

0 comments on commit 724e3f8

Please sign in to comment.