mapshaper 0.5.77 → 0.5.81

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.77",
3
+ "version": "0.5.81",
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) {
@@ -5327,6 +5327,10 @@
5327
5327
  hit.clearSelection();
5328
5328
  }
5329
5329
 
5330
+ function getIdsOpt() {
5331
+ return hit.getSelectionIds().join(',');
5332
+ }
5333
+
5330
5334
  hit.on('change', function(e) {
5331
5335
  if (e.mode != 'selection') return;
5332
5336
  var ids = hit.getSelectionIds();
@@ -5341,18 +5345,17 @@
5341
5345
  });
5342
5346
 
5343
5347
  new SimpleButton(popup.findChild('.delete-btn')).on('click', function() {
5344
- var cmd = '-filter "$$set.has(this.id) === false"';
5348
+ var cmd = '-filter invert ids=' + getIdsOpt();
5345
5349
  runCommand(cmd);
5346
5350
  });
5347
5351
 
5348
5352
  new SimpleButton(popup.findChild('.filter-btn')).on('click', function() {
5349
-
5350
- var cmd = '-filter "$$set.has(this.id)"';
5353
+ var cmd = '-filter ids=' + getIdsOpt();
5351
5354
  runCommand(cmd);
5352
5355
  });
5353
5356
 
5354
5357
  new SimpleButton(popup.findChild('.split-btn')).on('click', function() {
5355
- var cmd = '-each "split_id = $$set.has(this.id) ? \'1\' : \'2\'" -split split_id';
5358
+ var cmd = '-split ids=' + getIdsOpt();
5356
5359
  runCommand(cmd);
5357
5360
  });
5358
5361
 
@@ -5361,10 +5364,6 @@
5361
5364
  });
5362
5365
 
5363
5366
  function runCommand(cmd) {
5364
- // var defs = internal.getStateVar('defs');
5365
- // defs.$$selection = utils.arrayToIndex(hit.getSelectionIds());
5366
- var ids = JSON.stringify(hit.getSelectionIds());
5367
- cmd = `-define "$$set = new Set(${ids})" ${cmd} -define "delete $$set"`;
5368
5367
  popup.hide();
5369
5368
  if (gui.console) gui.console.runMapshaperCommands(cmd, function(err) {
5370
5369
  reset();
@@ -5987,7 +5986,6 @@
5987
5986
  return parent.querySelector(sel);
5988
5987
  }
5989
5988
 
5990
-
5991
5989
  function getTextTarget3(e) {
5992
5990
  if (e.id > -1 === false || !e.container) return null;
5993
5991
  return getSymbolNodeById(e.id, e.container);