mapshaper 0.6.22 → 0.6.23

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/mapshaper.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function () {
2
2
 
3
- var VERSION = "0.6.22";
3
+ var VERSION = "0.6.23";
4
4
 
5
5
 
6
6
  var utils = /*#__PURE__*/Object.freeze({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mapshaper",
3
- "version": "0.6.22",
3
+ "version": "0.6.23",
4
4
  "description": "A tool for editing vector datasets for mapping and GIS.",
5
5
  "keywords": [
6
6
  "shapefile",
package/www/index.html CHANGED
@@ -102,7 +102,7 @@
102
102
  <img class="pin-btn pinned" src="images/eye2.png">
103
103
  </div>
104
104
  <div class="layer-list"></div>
105
- <h3>Files</h3>
105
+ <h4>Sources</h4>
106
106
  <div class="file-list"></div>
107
107
  <div>
108
108
  <div id="add-file-btn" class="dialog-btn btn">Add a file</div>
@@ -159,6 +159,8 @@
159
159
  "precision=0.001"</div></div></div></div>
160
160
  <!-- <div class="cancel-btn btn dialog-btn">Cancel</div> -->
161
161
  <div class="save-btn btn dialog-btn">Export</div>
162
+ <span id="save-preference"><input type="checkbox"/>choose directory</span>
163
+
162
164
  </div>
163
165
  </div>
164
166
 
@@ -807,6 +807,19 @@
807
807
  return !!(mapshaper.manifest && mapshaper.manifest.allow_saving) && typeof fetch == 'function';
808
808
  };
809
809
 
810
+ GUI.setSavedValue = function(name, val) {
811
+ try {
812
+ window.localStorage.setItem(name, JSON.stringify(val));
813
+ } catch(e) {}
814
+ };
815
+
816
+ GUI.getSavedValue = function(name) {
817
+ try {
818
+ return JSON.parse(window.localStorage.getItem(name));
819
+ } catch(e) {}
820
+ return null;
821
+ };
822
+
810
823
  GUI.getUrlVars = function() {
811
824
  var q = window.location.search.substring(1);
812
825
  return q.split('&').reduce(function(memo, chunk) {
@@ -1232,8 +1245,9 @@
1232
1245
  }
1233
1246
 
1234
1247
  async function saveBlobToLocalFile(filename, blob, done) {
1248
+ var chooseDir = GUI.getSavedValue('choose-save-dir');
1235
1249
  done = done || function() {};
1236
- if (window.showSaveFilePicker) {
1250
+ if (chooseDir) {
1237
1251
  saveBlobToSelectedFile(filename, blob, done);
1238
1252
  } else {
1239
1253
  saveBlobToDownloadsFolder(filename, blob, done);
@@ -1241,7 +1255,7 @@
1241
1255
  }
1242
1256
 
1243
1257
  function showSaveDialog(filename, blob, done) {
1244
- showPopupAlert(`Save ${filename} to:`)
1258
+ var alert = showPopupAlert(`Save ${filename} to:`)
1245
1259
  .button('selected folder', function() {
1246
1260
  saveBlobToSelectedFile(filename, blob, done);
1247
1261
  })
@@ -1251,6 +1265,7 @@
1251
1265
  .onCancel(done);
1252
1266
  }
1253
1267
 
1268
+
1254
1269
  async function saveBlobToSelectedFile(filename, blob, done) {
1255
1270
  // see: https://developer.chrome.com/articles/file-system-access/
1256
1271
  // note: saving multiple files to a directory using showDirectoryPicker()
@@ -3656,10 +3671,14 @@
3656
3671
  internal.writeFiles = function() {
3657
3672
  error$1(unsupportedMsg);
3658
3673
  };
3659
- } else {
3660
- new SimpleButton(menu.findChild('.save-btn').addClass('default-btn')).on('click', onExportClick);
3661
- gui.addMode('export', turnOn, turnOff, exportBtn);
3662
- gui.keyboard.onMenuSubmit(menu, onExportClick);
3674
+ return;
3675
+ }
3676
+
3677
+ new SimpleButton(menu.findChild('.save-btn').addClass('default-btn')).on('click', onExportClick);
3678
+ gui.addMode('export', turnOn, turnOff, exportBtn);
3679
+ gui.keyboard.onMenuSubmit(menu, onExportClick);
3680
+ if (window.showSaveFilePicker) {
3681
+ menu.findChild('#save-preference').css('display', 'inline-block');
3663
3682
  }
3664
3683
 
3665
3684
  function turnOn() {
@@ -3683,6 +3702,8 @@
3683
3702
 
3684
3703
  function onExportClick() {
3685
3704
  var layers = getSelectedLayers();
3705
+ var chooseDir = menu.findChild('#save-preference input').node().checked;
3706
+ GUI.setSavedValue('choose-save-dir', chooseDir);
3686
3707
  if (layers.length === 0) {
3687
3708
  return gui.alert('No layers were selected');
3688
3709
  }
@@ -8697,7 +8718,6 @@
8697
8718
  function active(e) {
8698
8719
  return e.id > -1 && gui.interaction.getMode() == 'add-points';
8699
8720
  }
8700
-
8701
8721
  }
8702
8722
 
8703
8723
  function Pencil(gui, mouse, hit) {
@@ -8720,10 +8740,7 @@
8720
8740
  }
8721
8741
 
8722
8742
  function initDrawing(gui, ext, mouse, hit) {
8723
-
8724
8743
  initPointDrawing(gui, new Pencil(gui, mouse, hit));
8725
-
8726
-
8727
8744
  }
8728
8745
 
8729
8746
  var darkStroke = "#334",
package/www/mapshaper.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function () {
2
2
 
3
- var VERSION = "0.6.22";
3
+ var VERSION = "0.6.23";
4
4
 
5
5
 
6
6
  var utils = /*#__PURE__*/Object.freeze({
package/www/page.css CHANGED
@@ -292,9 +292,6 @@ div.error-box {
292
292
  font-size: 16px;
293
293
  }
294
294
 
295
- div.error-box > div {
296
-
297
- }
298
295
 
299
296
  /* --- Splash screen -------------- */
300
297
 
@@ -516,22 +513,26 @@ body.dragover #import-options-drop-area .drop-area {
516
513
  }
517
514
 
518
515
  .info-box h4 {
519
- font-size: 1em;
516
+ font-size: 1.085em;
520
517
  font-weight: normal;
521
- margin: 0 0 1px 0;
518
+ margin: 0 0 2px 0;
522
519
  }
523
520
 
524
521
  .info-box p {
525
522
  white-space: pre-line;
526
523
  margin: 0 0 7px 0;
524
+ line-height: 1.2;
525
+ font-size: 90%;
527
526
  }
528
527
 
529
528
  .option-menu {
530
529
  padding: 0 0 9px 0;
531
530
  }
532
531
 
533
- .option-menu input[type="radio"],
534
- .option-menu input[type="checkbox"]
532
+ /*.option-menu input[type="radio"],
533
+ .option-menu input[type="checkbox"] */
534
+ .info-box input[type="radio"],
535
+ .info-box input[type="checkbox"]
535
536
  {
536
537
  position: relative;
537
538
  top: 1px;
@@ -539,16 +540,16 @@ body.dragover #import-options-drop-area .drop-area {
539
540
  height: 12px;
540
541
  }
541
542
 
542
- .option-menu .tip-button {
543
+ .info-box .tip-button {
543
544
  margin-left: 12px;
544
545
  margin-top: 3px;
545
546
  }
546
547
 
547
- .option-menu input[type="checkbox"] {
548
+ .info-box input[type="checkbox"] {
548
549
  margin: 3px 5px 0 1px;
549
550
  }
550
551
 
551
- .option-menu input.radio {
552
+ .info-box input.radio {
552
553
  margin: 0 5px 0 0;
553
554
  }
554
555
 
@@ -1079,10 +1080,7 @@ img.close-btn:hover,
1079
1080
  height: 100%;
1080
1081
  }
1081
1082
 
1082
- .info-box p {
1083
- line-height: 1.2;
1084
- font-size: 90%;
1085
- }
1083
+
1086
1084
 
1087
1085
  .basemap-styles {
1088
1086
  margin: 0 -2px;
@@ -1212,6 +1210,13 @@ div.basemap-style-btn.active img {
1212
1210
  top: 23px;
1213
1211
  }
1214
1212
 
1213
+ #save-preference {
1214
+ display: none;
1215
+ position: relative;
1216
+ top: 1px;
1217
+ left: 5px;
1218
+ }
1219
+
1215
1220
  .nav-sub-menu {
1216
1221
  position: absolute;
1217
1222
  z-index: -1;