all files / mapbox-gl-draw/src/feature_types/ point.js

100% Statements 15/15
100% Branches 4/4
100% Functions 4/4
100% Lines 15/15
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28   124×                   20×      
const Feature = require('./feature');
 
const Point = function(ctx, geojson) {
  Feature.call(this, ctx, geojson);
};
 
Point.prototype = Object.create(Feature.prototype);
 
Point.prototype.isValid = function() {
  return typeof this.coordinates[0] === 'number' &&
    typeof this.coordinates[1] === 'number';
};
 
Point.prototype.updateCoordinate = function(pathOrLng, lngOrLat, lat) {
  if (arguments.length === 3) {
    this.coordinates = [lngOrLat, lat];
  } else {
    this.coordinates = [pathOrLng, lngOrLat];
  }
  this.changed();
};
 
Point.prototype.getCoordinate = function() {
  return this.getCoordinates();
};
 
module.exports = Point;