mapshaper 0.5.75 → 0.5.79

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.75",
3
+ "version": "0.5.79",
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",
@@ -485,6 +485,7 @@
485
485
  }
486
486
 
487
487
  function addCSS(el, css) {
488
+ // console.error(css);
488
489
  el.style.cssText = mergeCSS(el.style.cssText, css);
489
490
  }
490
491
 
@@ -1254,7 +1255,7 @@
1254
1255
 
1255
1256
  function receiveFiles(files) {
1256
1257
  var prevSize = queuedFiles.length;
1257
- useQuickView = overQuickView;
1258
+ useQuickView = useQuickView || overQuickView;
1258
1259
  files = handleZipFiles(utils.toArray(files));
1259
1260
  addFilesToQueue(files);
1260
1261
  if (queuedFiles.length === 0) return;
@@ -1750,7 +1751,7 @@
1750
1751
  else if (pct < 0.01) decimals = 3;
1751
1752
  else if (pct < 1) decimals = 2;
1752
1753
  else if (pct < 100) decimals = 1;
1753
- return utils.formatNumber(pct, decimals) + "%";
1754
+ return utils.formatNumberForDisplay(pct, decimals) + "%";
1754
1755
  });
1755
1756
 
1756
1757
  text.parser(function(s) {
@@ -2291,6 +2292,7 @@
2291
2292
  function onPaste(e) {
2292
2293
  // paste plain text (remove any copied HTML tags)
2293
2294
  e.preventDefault();
2295
+ e.stopPropagation(); // don't try to import pasted text as data (see gui-import-control.js)
2294
2296
  var str = (e.originalEvent || e).clipboardData.getData('text/plain');
2295
2297
  document.execCommand("insertHTML", false, str);
2296
2298
  }
@@ -5325,6 +5327,10 @@
5325
5327
  hit.clearSelection();
5326
5328
  }
5327
5329
 
5330
+ function getIdsOpt() {
5331
+ return hit.getSelectionIds().join(',');
5332
+ }
5333
+
5328
5334
  hit.on('change', function(e) {
5329
5335
  if (e.mode != 'selection') return;
5330
5336
  var ids = hit.getSelectionIds();
@@ -5339,18 +5345,17 @@
5339
5345
  });
5340
5346
 
5341
5347
  new SimpleButton(popup.findChild('.delete-btn')).on('click', function() {
5342
- var cmd = '-filter "$$set.has(this.id) === false"';
5348
+ var cmd = '-filter invert ids=' + getIdsOpt();
5343
5349
  runCommand(cmd);
5344
5350
  });
5345
5351
 
5346
5352
  new SimpleButton(popup.findChild('.filter-btn')).on('click', function() {
5347
-
5348
- var cmd = '-filter "$$set.has(this.id)"';
5353
+ var cmd = '-filter ids=' + getIdsOpt();
5349
5354
  runCommand(cmd);
5350
5355
  });
5351
5356
 
5352
5357
  new SimpleButton(popup.findChild('.split-btn')).on('click', function() {
5353
- var cmd = '-each "split_id = $$set.has(this.id) ? \'1\' : \'2\'" -split split_id';
5358
+ var cmd = '-split ids=' + getIdsOpt();
5354
5359
  runCommand(cmd);
5355
5360
  });
5356
5361
 
@@ -5359,10 +5364,6 @@
5359
5364
  });
5360
5365
 
5361
5366
  function runCommand(cmd) {
5362
- // var defs = internal.getStateVar('defs');
5363
- // defs.$$selection = utils.arrayToIndex(hit.getSelectionIds());
5364
- var ids = JSON.stringify(hit.getSelectionIds());
5365
- cmd = `-define "$$set = new Set(${ids})" ${cmd} -define "delete $$set"`;
5366
5367
  popup.hide();
5367
5368
  if (gui.console) gui.console.runMapshaperCommands(cmd, function(err) {
5368
5369
  reset();