mapshaper 0.5.76 → 0.5.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mapshaper",
3
- "version": "0.5.76",
3
+ "version": "0.5.80",
4
4
  "description": "A tool for editing vector datasets for mapping and GIS.",
5
5
  "keywords": [
6
6
  "shapefile",
@@ -49,7 +49,7 @@
49
49
  "geokdbush": "^1.1.0",
50
50
  "iconv-lite": "0.4.24",
51
51
  "kdbush": "^3.0.0",
52
- "mproj": "0.0.34",
52
+ "mproj": "0.0.35",
53
53
  "opn": "^5.3.0",
54
54
  "rw": "~1.3.3",
55
55
  "sync-request": "5.0.0",
@@ -1751,7 +1751,7 @@
1751
1751
  else if (pct < 0.01) decimals = 3;
1752
1752
  else if (pct < 1) decimals = 2;
1753
1753
  else if (pct < 100) decimals = 1;
1754
- return utils.formatNumber(pct, decimals) + "%";
1754
+ return utils.formatNumberForDisplay(pct, decimals) + "%";
1755
1755
  });
1756
1756
 
1757
1757
  text.parser(function(s) {
@@ -2292,6 +2292,7 @@
2292
2292
  function onPaste(e) {
2293
2293
  // paste plain text (remove any copied HTML tags)
2294
2294
  e.preventDefault();
2295
+ e.stopPropagation(); // don't try to import pasted text as data (see gui-import-control.js)
2295
2296
  var str = (e.originalEvent || e).clipboardData.getData('text/plain');
2296
2297
  document.execCommand("insertHTML", false, str);
2297
2298
  }
@@ -5326,6 +5327,10 @@
5326
5327
  hit.clearSelection();
5327
5328
  }
5328
5329
 
5330
+ function getIdsOpt() {
5331
+ return hit.getSelectionIds().join(',');
5332
+ }
5333
+
5329
5334
  hit.on('change', function(e) {
5330
5335
  if (e.mode != 'selection') return;
5331
5336
  var ids = hit.getSelectionIds();
@@ -5340,18 +5345,17 @@
5340
5345
  });
5341
5346
 
5342
5347
  new SimpleButton(popup.findChild('.delete-btn')).on('click', function() {
5343
- var cmd = '-filter "$$set.has(this.id) === false"';
5348
+ var cmd = '-filter invert ids=' + getIdsOpt();
5344
5349
  runCommand(cmd);
5345
5350
  });
5346
5351
 
5347
5352
  new SimpleButton(popup.findChild('.filter-btn')).on('click', function() {
5348
-
5349
- var cmd = '-filter "$$set.has(this.id)"';
5353
+ var cmd = '-filter ids=' + getIdsOpt();
5350
5354
  runCommand(cmd);
5351
5355
  });
5352
5356
 
5353
5357
  new SimpleButton(popup.findChild('.split-btn')).on('click', function() {
5354
- var cmd = '-each "split_id = $$set.has(this.id) ? \'1\' : \'2\'" -split split_id';
5358
+ var cmd = '-split ids=' + getIdsOpt();
5355
5359
  runCommand(cmd);
5356
5360
  });
5357
5361
 
@@ -5360,10 +5364,6 @@
5360
5364
  });
5361
5365
 
5362
5366
  function runCommand(cmd) {
5363
- // var defs = internal.getStateVar('defs');
5364
- // defs.$$selection = utils.arrayToIndex(hit.getSelectionIds());
5365
- var ids = JSON.stringify(hit.getSelectionIds());
5366
- cmd = `-define "$$set = new Set(${ids})" ${cmd} -define "delete $$set"`;
5367
5367
  popup.hide();
5368
5368
  if (gui.console) gui.console.runMapshaperCommands(cmd, function(err) {
5369
5369
  reset();