mapshaper 0.6.75 → 0.6.77

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/www/mapshaper.js CHANGED
@@ -1537,7 +1537,6 @@
1537
1537
  this.xmax = c;
1538
1538
  this.ymax = d;
1539
1539
  if (a > c || b > d) this.update();
1540
- // error("Bounds#setBounds() min/max reversed:", a, b, c, d);
1541
1540
  return this;
1542
1541
  };
1543
1542
 
@@ -5123,10 +5122,12 @@
5123
5122
  if (!P && info.prj) {
5124
5123
  P = parseCrsString(translatePrj(info.prj));
5125
5124
  }
5126
- if (!P && probablyDecimalDegreeBounds(getDatasetBounds(dataset))) {
5127
- // use wgs84 for probable latlong datasets with unknown datums
5128
- str = 'wgs84';
5129
- P = parseCrsString(str);
5125
+ if (!P) {
5126
+ if (probablyDecimalDegreeBounds(getDatasetBounds(dataset))) {
5127
+ // use wgs84 for probable latlong datasets with unknown datums
5128
+ str = 'wgs84';
5129
+ P = parseCrsString(str);
5130
+ }
5130
5131
  }
5131
5132
  return {
5132
5133
  crs: P || null,
@@ -7202,6 +7203,12 @@
7202
7203
  return bounds;
7203
7204
  }
7204
7205
 
7206
+ function datasetIsEmpty(dataset) {
7207
+ return dataset.layers.every(function(lyr) {
7208
+ return layerIsEmpty(lyr);
7209
+ });
7210
+ }
7211
+
7205
7212
  function datasetHasGeometry(dataset) {
7206
7213
  return utils.some(dataset.layers, function(lyr) {
7207
7214
  return layerHasGeometry(lyr);
@@ -7315,6 +7322,7 @@
7315
7322
  copyDatasetForExport: copyDatasetForExport,
7316
7323
  copyDatasetForRenaming: copyDatasetForRenaming,
7317
7324
  getDatasetBounds: getDatasetBounds,
7325
+ datasetIsEmpty: datasetIsEmpty,
7318
7326
  datasetHasGeometry: datasetHasGeometry,
7319
7327
  datasetHasPaths: datasetHasPaths,
7320
7328
  cleanupArcs: cleanupArcs,
@@ -13189,14 +13197,11 @@
13189
13197
  return findVertexIds(p2.x, p2.y, arcs);
13190
13198
  }
13191
13199
 
13192
- function snapVerticesToPoint(ids, p, arcs, final) {
13200
+ function snapVerticesToPoint(ids, p, arcs) {
13193
13201
  var data = arcs.getVertexData();
13194
13202
  ids.forEach(function(idx) {
13195
- if (final) {
13196
- // recalculate bounding box for arc
13197
- arcs.updateArcBounds(findArcIdFromVertexId(idx, data.ii));
13198
- }
13199
13203
  setVertexCoords(p[0], p[1], idx, arcs);
13204
+ arcs.updateArcBounds(findArcIdFromVertexId(idx, data.ii));
13200
13205
  });
13201
13206
  }
13202
13207
 
@@ -13452,7 +13457,7 @@
13452
13457
  // range = Math.min(w, h) + 1e-8,
13453
13458
  range = Math.max(w, h) + 1e-8,
13454
13459
  digits = 0;
13455
- while (range < 2000) {
13460
+ while (range < 2000 && digits < 1) {
13456
13461
  range *= 10;
13457
13462
  digits++;
13458
13463
  }
@@ -19959,8 +19964,8 @@
19959
19964
  }
19960
19965
 
19961
19966
  function parseScalebarUnits(str) {
19962
- var isMiles = /miles?$/.test(str.toLowerCase());
19963
- var isKm = /(k\.m\.|km|kilometers?|kilometres?)$/.test(str.toLowerCase());
19967
+ var isMiles = /(miles?|mi[.]?|英里)$/.test(str.toLowerCase());
19968
+ var isKm = /(k\.m\.|km|kilometers?|kilom.tres?|公里)$/.test(str.toLowerCase());
19964
19969
  var units = isMiles && 'mile' || isKm && 'km' || '';
19965
19970
  return units;
19966
19971
  }
@@ -29355,7 +29360,7 @@ ${svg}
29355
29360
  // * In TopoJSON input, it makes sense to think of the last object/layer
29356
29361
  // as the topmost one -- it corresponds to the painter's algorithm and
29357
29362
  // the way that objects are ordered in SVG.
29358
- var lyr = targ.layers[targ.layers.length - 1];
29363
+ var lyr = targ?.layers[targ.layers.length - 1];
29359
29364
  return targ ? {layer: lyr, dataset: targ.dataset} : null;
29360
29365
  };
29361
29366
 
@@ -45139,7 +45144,7 @@ ${svg}
45139
45144
  opts.target, getFormattedLayerList(job.catalog)));
45140
45145
  }
45141
45146
  if (!commandAcceptsEmptyTarget(name)) {
45142
- throw new UserError("No data is available");
45147
+ stop("No data is available");
45143
45148
  }
45144
45149
  }
45145
45150
 
@@ -45525,7 +45530,7 @@ ${svg}
45525
45530
  });
45526
45531
  }
45527
45532
 
45528
- var version = "0.6.75";
45533
+ var version = "0.6.77";
45529
45534
 
45530
45535
  // Parse command line args into commands and run them
45531
45536
  // Function takes an optional Node-style callback. A Promise is returned if no callback is given.
package/www/page.css CHANGED
@@ -31,7 +31,7 @@ html, body {
31
31
 
32
32
  body {
33
33
  overflow: hidden;
34
- background-color: #fff;
34
+ background-color: #f8fdff;
35
35
  font: 14px/1.4 'Source Sans Pro', Arial, sans-serif;
36
36
  color: #444;
37
37
  user-select: none;
@@ -40,6 +40,10 @@ body {
40
40
  cursor: default;
41
41
  }
42
42
 
43
+ body.map-view {
44
+ background-color: #fff;
45
+ }
46
+
43
47
  .fade-out {
44
48
  animation: fadeOut ease forwards 0.6s;
45
49
  }
@@ -65,12 +69,14 @@ body {
65
69
  /* --- Themed elements -------------- */
66
70
 
67
71
  .page-header,
68
- .dialog-btn {
72
+ .dialog-btn,
73
+ .sidebar-btn {
69
74
  background-color: #1385B7;
70
75
  }
71
76
 
72
77
  .colored-text,
73
78
  .save-menu-link,
79
+ .context-menu-item,
74
80
  .save-menu-btn,
75
81
  .add-field-btn,
76
82
  .nav-menu-item,
@@ -112,6 +118,7 @@ body {
112
118
  }
113
119
 
114
120
  .dialog-btn:hover:not(.disabled),
121
+ .sidebar-btn:hover,
115
122
  .btn.header-btn:hover,
116
123
  .dialog-btn.default-btn,
117
124
  .dialog-btn.selected-btn {
@@ -175,12 +182,16 @@ body {
175
182
  text-decoration: none;
176
183
  }
177
184
 
185
+ #mode-buttons.page-header-buttons {
186
+ display: none;
187
+
188
+ }
189
+
178
190
  .page-header-buttons {
179
191
  z-index: 20;
180
192
  position: absolute;
181
193
  top: 0px;
182
194
  right: 0px;
183
- display: none;
184
195
  margin: 0 6px 3px 0;
185
196
  }
186
197
 
@@ -199,6 +210,7 @@ body {
199
210
  .page-header .header-btn.disabled,
200
211
  .page-header .header-btn.disabled:hover {
201
212
  background-color: transparent;
213
+ opacity: 0.5;
202
214
  }
203
215
 
204
216
  .page-header .btn.header-btn.active,
@@ -228,17 +240,18 @@ body {
228
240
  pointer-events: none;
229
241
  }
230
242
 
231
- .box-tool-options .btn {
243
+ .box-tool-options .btn,
244
+ .selection-tool-options .btn {
232
245
  pointer-events: initial;
233
246
  }
234
247
 
235
- .box-tool-options .info-box {
236
- text-align: center;
237
- }
238
-
239
248
  .box-coords {
240
- margin-top: 7px;
249
+ margin-top: -23px;
241
250
  pointer-events: initial;
251
+ position: absolute;
252
+ z-index: -1;
253
+ padding: 1px 25px;
254
+ right: 55px;
242
255
  }
243
256
 
244
257
  /* --- Export dialog --------- */
@@ -327,105 +340,28 @@ div.alert-box {
327
340
 
328
341
  /* --- Splash screen -------------- */
329
342
 
330
- .splash-screen #splash-screen {
331
- display: block;
332
- }
333
-
334
- .splash-screen #splash-buttons {
335
- display: block;
336
- }
337
-
338
- .queued-files.splash-screen #import-options-drop-area {
339
- display: block;
340
- z-index: 2;
341
- }
342
-
343
- #import-options-drop-area .drop-area {
344
- height: 100%;
343
+ .import-instructions {
344
+ margin: 7px 0 0 0;
345
345
  }
346
346
 
347
- #splash-screen {
348
- z-index: 1;
349
- text-align: center;
347
+ .mini-drop-area {
348
+ border: 1.5px dashed #bbb;
349
+ max-width: 240px;
350
+ border-radius: 9px;
350
351
  font-size: 15px;
351
- display: none;
352
- }
353
-
354
- #splash-screen, #import-options-drop-area {
355
- background-color: #def1f9;
356
- }
357
-
358
- #splash-screen .subtitle {
359
- color: #777;
360
- }
361
-
362
- .splash-screen #import-options .info-box {
363
- margin-top: 40px;
364
- }
365
-
366
- .queued-files #import-options {
367
- display: block;
368
- }
369
-
370
- #splash-screen *,
371
- #import-options-drop-area * {
372
- box-sizing: border-box;
373
- }
374
-
375
- .drop-area {
376
- border: 2px dashed #a2a2a2;
377
- border-radius: 19px;
378
- background-color: #f8fdff;
379
- overflow: hidden;
380
- }
381
-
382
- #splash-screen .drop-area.dragover,
383
- body.dragover #import-options-drop-area .drop-area {
384
- border-color: #333;
385
- }
386
-
387
- #drop-areas {
388
- margin-top: 30px;
352
+ line-height: 1.5;
353
+ color: #888;
354
+ /* background-color: #FFFEF8;*/
355
+ padding: 6px 4px 7px 7px;
356
+ padding: 11px 14px;
357
+ margin: 9px -1px 3px -1px;
358
+ min-height: 120px;
389
359
  }
390
360
 
391
- .drop-area-wrapper {
392
- padding: 16px 16px 15px 16px;
393
- }
394
-
395
- .catalog-mode #import-drop,
396
- .catalog-mode #import-quick-drop,
397
361
  .catalog-mode .file-catalog {
398
362
  height: 32%;
399
363
  }
400
364
 
401
- #import-drop {
402
- height: 61.6%;
403
- }
404
-
405
- #import-quick-drop {
406
- height: 37%;
407
- }
408
-
409
- .queued-files #splash-screen {
410
- display: none;
411
- }
412
-
413
- /* between the two drop areas */
414
- #splash-screen .spacer {
415
- height: 1.6%;
416
- }
417
-
418
- #splash-screen h3 {
419
- margin: 11px 0 0 0;
420
- color: #333;
421
- font-size: 18px;
422
- }
423
-
424
- #splash-screen h4 {
425
- color: #333;
426
- font-size: 17px;
427
- margin: 11px 0 0 0;
428
- }
429
365
 
430
366
  #file-selection-btn.inline-btn {
431
367
  padding: 2px 4px 3px 3px;
@@ -505,7 +441,7 @@ body.dragover #import-options-drop-area .drop-area {
505
441
  }
506
442
 
507
443
  .dropped-file-list {
508
- margin-bottom: 8px;
444
+ margin-bottom: 4px;
509
445
  max-height: 300px;
510
446
  overflow-y: auto;
511
447
  }
@@ -528,6 +464,19 @@ body.dragover #import-options-drop-area .drop-area {
528
464
  margin-right: 16px;
529
465
  }
530
466
 
467
+ #import-options .queued-file-section {
468
+ display: none;
469
+ }
470
+
471
+ .queued-files #import-options .queued-file-section {
472
+ margin-top: 10px;
473
+ display: block;
474
+ }
475
+
476
+ .queued-files #import-options .import-instructions {
477
+ display: none;
478
+ }
479
+
531
480
 
532
481
  #import-options .dropped-file-list p {
533
482
  line-height: 1;
@@ -544,11 +493,27 @@ body.dragover #import-options-drop-area .drop-area {
544
493
 
545
494
  .info-box,.popup {
546
495
  border-radius: 9px;
547
- /* border: 1px solid #ddd; */
548
- box-shadow: 0 3px 6px rgba(0,0,0,0.35);
496
+ border: 1px solid #d5d5d5;
497
+ box-shadow: 0 1px 7px rgba(0,0,0,0.18);
498
+ background-color: #fff;
499
+ }
500
+
501
+ .contextmenu {
502
+ position: absolute;
503
+ border-radius: 6px;
504
+ border: 1px solid #d5d5d5;
505
+ box-shadow: 0 1px 7px rgba(0,0,0,0.18);
549
506
  background-color: #fff;
507
+ font-size: 13px;
508
+ z-index: 40;
509
+ padding: 4px 0;
550
510
  }
551
511
 
512
+ .contextmenu-item {
513
+ padding: 6px;
514
+ }
515
+
516
+
552
517
  .info-box {
553
518
  min-width: 230px;
554
519
  word-wrap: break-word;
@@ -561,6 +526,25 @@ body.dragover #import-options-drop-area .drop-area {
561
526
  /* border: 1px solid #aaa; */
562
527
  }
563
528
 
529
+ .sidebar-buttons {
530
+ display: none;
531
+ position: absolute;
532
+ background-color: white;
533
+ padding: 1px 3px;
534
+ top: 207px;
535
+ right: 0;
536
+ z-index: 19;
537
+ }
538
+
539
+ .btn.sidebar-btn {
540
+ display: block;
541
+ margin-bottom: 2px;
542
+ margin-top: 2px;
543
+ font-size: 13px;
544
+ color: white;
545
+ min-width: 28px;
546
+ }
547
+
564
548
  .info-box h3 {
565
549
  font-size: 19px;
566
550
  line-height: 1.1;
@@ -576,7 +560,7 @@ body.dragover #import-options-drop-area .drop-area {
576
560
  .info-box h4 {
577
561
  font-size: 1.085em;
578
562
  font-weight: normal;
579
- margin: 0 0 2px 0;
563
+ margin: 4px 0 2px 0;
580
564
  }
581
565
 
582
566
  .info-box p {
@@ -787,7 +771,7 @@ body.simplify .layer-control-btn {
787
771
  max-height: 500px;
788
772
  overflow: hidden;
789
773
  overflow-y: auto;
790
- padding: 9px 14px 6px 14px;
774
+ padding: 8px 14px 9px 14px;
791
775
  pointer-events: auto;
792
776
  border-radius: 9px;
793
777
  }
@@ -798,6 +782,11 @@ body.simplify .layer-control-btn {
798
782
  z-index: 90;
799
783
  }
800
784
 
785
+ .layer-control .no-layer-note {
786
+ color: #777;
787
+ margin: 4px 0 6px 0;
788
+ }
789
+
801
790
  .layer-menu .layer-list {
802
791
  margin: 6px 0 7px 0;
803
792
  }
@@ -839,7 +828,7 @@ img.close-btn {
839
828
 
840
829
  .close2-btn {
841
830
  display: inline-block;
842
- background-color: #eee;
831
+ background-color: #e5e5e5;
843
832
  background-image: url("images/close2.png");
844
833
  background-size: cover;
845
834
  float: right;
@@ -1014,6 +1003,7 @@ img.close-btn:hover,
1014
1003
  visibility: hidden;
1015
1004
  }*/
1016
1005
 
1006
+
1017
1007
  /* --- Popup -------------------- */
1018
1008
 
1019
1009
  .popup {
@@ -1220,6 +1210,10 @@ div.basemap-style-btn.active img {
1220
1210
  cursor: crosshair;
1221
1211
  }
1222
1212
 
1213
+ .map-layers.drawing.dragging {
1214
+ cursor: default;
1215
+ }
1216
+
1223
1217
  .map-layers canvas {
1224
1218
  pointer-events: none;
1225
1219
  position: absolute;
@@ -1249,11 +1243,19 @@ div.basemap-style-btn.active img {
1249
1243
  cursor: pointer;
1250
1244
  }
1251
1245
 
1246
+ .map-layers > svg text.active-label {
1247
+ stroke: #fac0ff; /* #efacf4; */
1248
+ paint-order: stroke fill;
1249
+ stroke-width: 4px;
1250
+ stroke-linecap: round;
1251
+ stroke-linejoin: round;
1252
+ }
1253
+
1252
1254
  /* --- MAP BUTTONS --- */
1253
1255
 
1254
- .pointer-btn {
1256
+ /*.pointer-btn {
1255
1257
  z-index: 2;
1256
- }
1258
+ }*/
1257
1259
 
1258
1260
  .nav-buttons {
1259
1261
  z-index: 20;
@@ -1283,9 +1285,6 @@ div.basemap-style-btn.active img {
1283
1285
  fill: black !important;
1284
1286
  }
1285
1287
 
1286
- .save-btn .save-menu {
1287
- top: 23px;
1288
- }
1289
1288
 
1290
1289
  .inline-checkbox {
1291
1290
  margin-left: 5px;
@@ -1297,13 +1296,22 @@ div.basemap-style-btn.active img {
1297
1296
 
1298
1297
  .nav-sub-menu {
1299
1298
  position: absolute;
1300
- z-index: -1;
1299
+ z-index: -1;
1301
1300
  display: none;
1302
1301
  pointer-events: none;
1303
- padding-top: 4px;
1304
- top: 27px;
1305
- right: -3px;
1302
+ padding: 5px 0px;
1303
+ background-color: white;
1304
+ top: 0px;
1305
+ right: 24px;
1306
+ text-align: right;
1306
1307
  white-space: nowrap;
1308
+ border-radius: 6px;
1309
+ border: 1px solid #ddd;
1310
+ box-shadow: 0 1px 7px rgba(0,0,0,0.12);
1311
+ }
1312
+
1313
+ .pointer-btn .nav-sub-menu {
1314
+ top: -3px;
1307
1315
  }
1308
1316
 
1309
1317
  .nav-btn.open .nav-sub-menu {
@@ -1311,33 +1319,6 @@ div.basemap-style-btn.active img {
1311
1319
  pointer-events: inherit;
1312
1320
  }
1313
1321
 
1314
- .nav-menu-item {
1315
- background-color: #fff;
1316
- float: right;
1317
- clear: right;
1318
- white-space: nowrap;
1319
- display: inline-block;
1320
- padding: 5px 7px 5px 7px;
1321
- line-height: 11px;
1322
- cursor: pointer;
1323
- }
1324
-
1325
-
1326
- .nav-menu-item:hover,
1327
- .nav-btn:hover .nav-sub-menu:not(.active):not(:hover) .nav-menu-item[data-name=info] {
1328
- font-weight: bold;
1329
- background: #e6f7ff;
1330
- }
1331
-
1332
- .nav-menu-item.selected {
1333
- color: black;
1334
- font-weight: bold;
1335
- }
1336
-
1337
- /* bullets https://www.w3schools.com/charsets/ref_utf_geometric.asp */
1338
- .nav-sub-menu.active .nav-menu-item.selected:before {
1339
- content: "\25B8 "
1340
- }
1341
1322
 
1342
1323
  .nav-btn {
1343
1324
  position: relative;
@@ -1353,7 +1334,6 @@ div.basemap-style-btn.active img {
1353
1334
 
1354
1335
  .nav-btn.selected {
1355
1336
  background-color: black;
1356
- /* border-radius: 3px; */
1357
1337
  }
1358
1338
 
1359
1339
  .nav-btn:hover:not(.disabled) svg *,
@@ -1365,16 +1345,43 @@ div.basemap-style-btn.active img {
1365
1345
  fill: white;
1366
1346
  }
1367
1347
 
1348
+ .nav-menu-item,
1349
+ .contextmenu-item {
1350
+ background-color: #fff;
1351
+ white-space: nowrap;
1352
+ padding: 6px 10px 7px 10px;
1353
+ line-height: 11px;
1354
+ cursor: pointer;
1355
+ }
1356
+
1357
+ .nav-menu-item:hover,
1358
+ .contextmenu-item:hover,
1359
+ .nav-btn:hover .nav-sub-menu:not(.active):not(:hover) .nav-menu-item[data-name=info] {
1360
+ color: black;
1361
+ background: #e6f7ff;
1362
+ }
1363
+
1364
+ .nav-menu-item.selected {
1365
+ color: black;
1366
+ }
1367
+
1368
+ /* bullets https://www.w3schools.com/charsets/ref_utf_geometric.asp */
1369
+ .nav-sub-menu.active .nav-menu-item.selected:before {
1370
+ content: "\25B8";
1371
+ position: relative;
1372
+ margin-left: -7px;
1373
+ left: -2px;
1374
+ top: 1px;
1375
+ }
1376
+
1368
1377
  .save-menu {
1369
1378
  text-align: right;
1370
1379
  padding-bottom: 5px;
1371
1380
  }
1372
1381
 
1373
1382
  .save-menu-entry {
1374
- /* padding: 4px 7px 5px 7px; */
1375
1383
  line-height: 11px;
1376
1384
  padding: 4px 7px 5px 7px;
1377
- display: inline-block;
1378
1385
  background: white;
1379
1386
  }
1380
1387
 
@@ -1410,8 +1417,7 @@ div.basemap-style-btn.active img {
1410
1417
 
1411
1418
 
1412
1419
  .save-menu-link:hover {
1413
- /* background: #e6f7ff; */
1414
- font-weight: bold;
1420
+ color: black;
1415
1421
  }
1416
1422
 
1417
1423
  .save-item-label {