Fixes for review comments

Reverted icons.css to master
Removed index.html/icon-route class and modified size for SVG icon on button
Refactored RouteOpisometer.trackCell so that duplicate code is pulled outside of if blocks
This commit is contained in:
Richard Robertson 2021-03-12 12:14:16 -06:00
parent 426ee32ee5
commit f0f7ebb71f
3 changed files with 7 additions and 14 deletions

View file

@ -204,7 +204,6 @@
.icon-chess-pawn:before {content:'\f443';} /* '' */ .icon-chess-pawn:before {content:'\f443';} /* '' */
.icon-chess-queen:before {content:'\f445';} /* '' */ .icon-chess-queen:before {content:'\f445';} /* '' */
.icon-chess-rook:before {content:'\f447';} /* '' */ .icon-chess-rook:before {content:'\f447';} /* '' */
/*.icon-route:before {content:'\f4d7';} /* '' */
.icon-sign:before {content:'\f4d9';} /* '' */ .icon-sign:before {content:'\f4d9';} /* '' */
.icon-user-friends:before {content:'\f500';} /* '' */ .icon-user-friends:before {content:'\f500';} /* '' */
.icon-user-shield:before {content:'\f505';} /* '' */ .icon-user-shield:before {content:'\f505';} /* '' */

View file

@ -3099,8 +3099,8 @@
<div id="unitsBottom"> <div id="unitsBottom">
<button id="addLinearRuler" data-tip="Click to place a linear measurer (ruler)" class="icon-ruler"></button> <button id="addLinearRuler" data-tip="Click to place a linear measurer (ruler)" class="icon-ruler"></button>
<button id="addOpisometer" data-tip="Drag to measure a curve length (opisometer)" class="icon-drafting-compass"></button> <button id="addOpisometer" data-tip="Drag to measure a curve length (opisometer)" class="icon-drafting-compass"></button>
<button id="addRouteOpisometer" data-tip="Drag to measure a curve length that sticks to routes (route opisometer)" class="icon-route"> <button id="addRouteOpisometer" data-tip="Drag to measure a curve length that sticks to routes (route opisometer)">
<svg width="1em" height="1em"> <svg width="0.88em" height="0.88em">
<use xlink:href="#icon-route" /> <use xlink:href="#icon-route" />
</svg> </svg>
</button> </button>

View file

@ -333,13 +333,9 @@ class RouteOpisometer extends Measurer {
} else if (cellStops.length > 1 && foundIndex != -1) { } else if (cellStops.length > 1 && foundIndex != -1) {
cellStops.splice(foundIndex + 1); cellStops.splice(foundIndex + 1);
this.points.splice(foundIndex + 1); this.points.splice(foundIndex + 1);
this.updateCurve();
this.updateLabel();
} else { } else {
cellStops.push(cell); cellStops.push(cell);
this.points.push(this.getCellRouteCoord(cell)); this.points.push(this.getCellRouteCoord(cell));
this.updateCurve();
this.updateLabel();
} }
} else { } else {
if (cellStops[0] === cell) { if (cellStops[0] === cell) {
@ -347,16 +343,14 @@ class RouteOpisometer extends Measurer {
} else if (cellStops.length > 1 && foundIndex != -1) { } else if (cellStops.length > 1 && foundIndex != -1) {
cellStops.splice(0, foundIndex); cellStops.splice(0, foundIndex);
this.points.splice(0, foundIndex); this.points.splice(0, foundIndex);
this.updateCurve();
this.updateLabel();
} else { } else {
cellStops.unshift(cell); cellStops.unshift(cell);
this.points.unshift(this.getCellRouteCoord(cell)); this.points.unshift(this.getCellRouteCoord(cell));
}
}
this.updateCurve(); this.updateCurve();
this.updateLabel(); this.updateLabel();
} }
}
}
getCellRouteCoord(c) { getCellRouteCoord(c) {
const cells = pack.cells; const cells = pack.cells;