mapshaper 0.6.54 → 0.6.55

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.54";
3
+ var VERSION = "0.6.55";
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.54",
3
+ "version": "0.6.55",
4
4
  "description": "A tool for editing vector datasets for mapping and GIS.",
5
5
  "keywords": [
6
6
  "shapefile",
package/www/index.html CHANGED
@@ -308,9 +308,10 @@ encoding=big5</span>. Click to see all options.</div></div></div></div>
308
308
  <div class="mshp-main-map main-area map-area">
309
309
  <div class="coordinate-info colored-text selectable"></div>
310
310
  <div class="intersection-display">
311
- <div class="intersection-check text-btn colored-text">Check line intersections</div>
312
- <div class="intersection-count">0 line intersections</div>
311
+ <span class="intersection-check text-btn colored-text">Check line intersections</span><span class="intersection-count">0 line intersections</span>
312
+ <img class="close-btn" src="images/close.png">
313
313
  <div class="repair-btn text-btn colored-text">Repair</div>
314
+
314
315
  </div>
315
316
  <div class="map-layers"></div>
316
317
  <div class="basemap-container"><div class="basemap"></div></div>
@@ -654,8 +654,9 @@
654
654
  },
655
655
 
656
656
  show: function(css) {
657
+ var tag = this.el && this.el.tagName;
657
658
  if (!this.visible()) {
658
- this.css('display:block;');
659
+ this.css('display', tag == 'SPAN' ? 'inline-block' : 'block');
659
660
  this._hidden = false;
660
661
  }
661
662
  return this;
@@ -3561,7 +3562,10 @@
3561
3562
  repairBtn = el.findChild(".repair-btn"),
3562
3563
  _simplifiedXX, // saved simplified intersections, for repair
3563
3564
  _unsimplifiedXX, // saved unsimplified intersection data, for performance
3564
- _disabled = false;
3565
+ _disabled = false,
3566
+ _on = false;
3567
+
3568
+ el.findChild('.close-btn').on('click', dismissForever);
3565
3569
 
3566
3570
  gui.on('simplify_drag_start', function() {
3567
3571
  if (intersectionsAreOn()) {
@@ -3570,19 +3574,20 @@
3570
3574
  });
3571
3575
 
3572
3576
  gui.on('simplify_drag_end', function() {
3573
- updateAsync();
3577
+ updateSync('simplify_drag_end');
3574
3578
  });
3575
3579
 
3576
3580
  checkBtn.on('click', function() {
3577
3581
  checkBtn.hide();
3578
- refreshSync();
3582
+ _on = true;
3583
+ updateSync();
3579
3584
  });
3580
3585
 
3581
3586
  repairBtn.on('click', function() {
3582
3587
  var e = model.getActiveLayer();
3583
3588
  if (!_simplifiedXX || !e.dataset.arcs) return;
3584
- var xx = _simplifiedXX = internal.repairIntersections(e.dataset.arcs, _simplifiedXX);
3585
- showIntersections(xx, e.layer, e.dataset.arcs);
3589
+ _simplifiedXX = internal.repairIntersections(e.dataset.arcs, _simplifiedXX);
3590
+ showIntersections(_simplifiedXX, e.layer, e.dataset.arcs);
3586
3591
  repairBtn.hide();
3587
3592
  model.updated({repair: true});
3588
3593
  gui.session.simplificationRepair();
@@ -3593,7 +3598,8 @@
3593
3598
  reset(); // need this?
3594
3599
  return;
3595
3600
  }
3596
- var needRefresh = e.flags.simplify_method || e.flags.simplify || e.flags.repair;
3601
+ var needRefresh = e.flags.simplify_method || e.flags.simplify ||
3602
+ e.flags.repair || e.flags.clean;
3597
3603
  if (needRefresh) {
3598
3604
  updateAsync();
3599
3605
  } else if (e.flags.simplify_amount) {
@@ -3608,17 +3614,18 @@
3608
3614
  });
3609
3615
 
3610
3616
  function intersectionsAreOn() {
3611
- return !!(_simplifiedXX || _unsimplifiedXX);
3617
+ return _on && !_disabled;
3612
3618
  }
3613
3619
 
3614
- function clearSavedData() {
3620
+ function turnOff() {
3621
+ hide();
3622
+ _on = false;
3615
3623
  _simplifiedXX = null;
3616
3624
  _unsimplifiedXX = null;
3617
3625
  }
3618
3626
 
3619
3627
  function reset() {
3620
- clearSavedData();
3621
- hide();
3628
+ turnOff();
3622
3629
  if (_disabled) {
3623
3630
  return;
3624
3631
  }
@@ -3633,8 +3640,7 @@
3633
3640
 
3634
3641
  function dismissForever() {
3635
3642
  _disabled = true;
3636
- clearSavedData();
3637
- hide();
3643
+ turnOff();
3638
3644
  }
3639
3645
 
3640
3646
  function hide() {
@@ -3645,12 +3651,11 @@
3645
3651
  // Update intersection display, after a short delay so map can redraw after previous
3646
3652
  // operation (e.g. simplification change)
3647
3653
  function updateAsync() {
3648
- if (intersectionsAreOn()) {
3649
- setTimeout(refreshSync, 10);
3650
- }
3654
+ setTimeout(updateSync, 10);
3651
3655
  }
3652
3656
 
3653
- function refreshSync() {
3657
+ function updateSync(action) {
3658
+ if (!intersectionsAreOn()) return;
3654
3659
  var e = model.getActiveLayer();
3655
3660
  var arcs = e.dataset && e.dataset.arcs;
3656
3661
  var intersectionOpts = {
@@ -3661,13 +3666,14 @@
3661
3666
  return;
3662
3667
  }
3663
3668
  if (arcs.getRetainedInterval() > 0) {
3669
+ // simplification
3664
3670
  _simplifiedXX = internal.findSegmentIntersections(arcs, intersectionOpts);
3665
3671
  } else {
3666
3672
  // no simplification
3667
- _simplifiedXX = null; // clear old simplified XX
3668
- if (!_unsimplifiedXX) {
3669
- // save intersections at 0 simplification, to avoid recalculating
3670
- // every time the simplification slider is set to 100% or the layer is selected at 100%
3673
+ _simplifiedXX = null; // clear any old simplified XX
3674
+ if (_unsimplifiedXX && action == 'simplify_drag_end') {
3675
+ // re-use previously generated intersection data (optimization)
3676
+ } else {
3671
3677
  _unsimplifiedXX = internal.findSegmentIntersections(arcs, intersectionOpts);
3672
3678
  }
3673
3679
  }
@@ -3675,7 +3681,7 @@
3675
3681
  }
3676
3682
 
3677
3683
  function showIntersections(xx, lyr, arcs) {
3678
- var pointLyr, count = 0;
3684
+ var pointLyr, count = 0, html;
3679
3685
  el.show();
3680
3686
  readout.show();
3681
3687
  checkBtn.hide();
@@ -3685,12 +3691,13 @@
3685
3691
  }
3686
3692
  if (count == 0) {
3687
3693
  map.setIntersectionLayer(null);
3688
- readout.html('<span class="icon black"></span>No self-intersections');
3694
+ html = '<span class="icon black"></span>No self-intersections';
3689
3695
  } else {
3690
3696
  map.setIntersectionLayer(pointLyr, {layers:[pointLyr]});
3691
- readout.html(utils$1.format('<span class="icon"></span>%s line intersection%s <img class="close-btn" src="images/close.png">', count, utils$1.pluralSuffix(count)));
3692
- readout.findChild('.close-btn').on('click', dismissForever);
3697
+ html = utils$1.format('<span class="icon"></span>%s line intersection%s', count, utils$1.pluralSuffix(count));
3693
3698
  }
3699
+ readout.html(html);
3700
+
3694
3701
  if (_simplifiedXX && count > 0) {
3695
3702
  repairBtn.show();
3696
3703
  } else {
package/www/mapshaper.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function () {
2
2
 
3
- var VERSION = "0.6.54";
3
+ var VERSION = "0.6.55";
4
4
 
5
5
 
6
6
  var utils = /*#__PURE__*/Object.freeze({
package/www/page.css CHANGED
@@ -959,10 +959,6 @@ img.close-btn:hover,
959
959
  left: 13px;
960
960
  }
961
961
 
962
- .intersection-count {
963
- vertical-align: middle;
964
- }
965
-
966
962
  .intersection-check {
967
963
  display: none;
968
964
  }
@@ -979,13 +975,13 @@ img.close-btn:hover,
979
975
  background-color: black;
980
976
  }
981
977
 
982
- .intersection-count .close-btn {
978
+ .intersection-display .close-btn {
983
979
  width: 16px;
984
980
  height: 16px;
985
981
  cursor: pointer;
986
982
  position: relative;
987
983
  top: 4px;
988
- margin-left: 2px;
984
+ margin-left: 1px;
989
985
  }
990
986
 
991
987
  /*.intersection-display .text-btn.disabled {