Skip to content

Commit

Permalink
rev leaflet
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin McFadden committed Oct 16, 2024
1 parent 0b869f4 commit 76d2a39
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 63 deletions.
39 changes: 14 additions & 25 deletions assets/leaflet-treering/Leaflet.AreaCapture.js
Original file line number Diff line number Diff line change
Expand Up @@ -690,10 +690,10 @@ function NewEllipse(Inte) {
L.DomEvent.on(window, 'keydown', (e) => {
if (e.keyCode == 69 && e.getModifierState("Shift") && !e.getModifierState("Control") &&
window.name.includes('popout') && !Inte.treering.annotationAsset.dialogAnnotationWindow) { // Dialog windows w/ text cannot be active
e.preventDefault();
e.stopPropagation();
Inte.treering.disableTools();
this.enable();
e.preventDefault();
e.stopPropagation();
Inte.treering.disableTools();
this.enable();
}
}, this);

Expand Down Expand Up @@ -812,8 +812,8 @@ function NewEllipse(Inte) {
* @param {object} Inte - AreaCaptureInterface object. Allows access to all other tools.
*/
function NewEllipseDialog(Inte) {
let minWidth = 130;
let minHeight = 130;
let minWidth = 180;
let minHeight = 170;
this.size = [minWidth, minHeight];
this.anchor = [50, 0];

Expand Down Expand Up @@ -880,25 +880,14 @@ function NewEllipseDialog(Inte) {
* @function
*/
NewEllipseDialog.prototype.createDialogEventListeners = function () {
// Year editing buttons:
$("#AreaCapture-editYear-btn").on("click", () => {
let html = document.getElementById("AreaCapture-newYearDialog-template").innerHTML;
let template = Handlebars.compile(html);
let content = template({
"year": Inte.ellipseData.year,
});
this.dialog.setContent(content);
document.getElementById("AreaCapture-newYear-input").select();

$("#AreaCapture-confirmYear-btn").on("click", () => {
let year = $("#AreaCapture-newYear-input").val();
if (year || year == 0) {
Inte.ellipseVisualAssets.cycleColorsMulti(year);
Inte.ellipseData.year = year;
}
this.update();
})
});
$("#AreaCapture-confirmYear-btn").on("click", () => {
let year = $("#AreaCapture-newYear-input").val();
if (year || year == 0) {
Inte.ellipseVisualAssets.cycleColorsMulti(year);
Inte.ellipseData.year = year;
}
this.update();
})

$("#AreaCapture-subtractYear-btn").on("click", () => {
Inte.ellipseData.decreaseYear();
Expand Down
2 changes: 0 additions & 2 deletions assets/leaflet-treering/Leaflet.PithEstimate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* @version 1.0.0
*/

const { point } = require("leaflet");

/**
* Interface for pith estimate tools.
* @constructor
Expand Down
47 changes: 15 additions & 32 deletions assets/leaflet-treering/Template.AreaCapture.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
<script id="AreaCapture-incrementDialog-template" type="text/x-handlebars-template">
<div class="AreaCapture-dialog-container">
<div class="AreaCapture-editYear-container">
<p class="AreaCapture-text">
Year: {{ year }}

<i id="AreaCapture-editYear-btn"
class="fa fa-pencil-square"
style="float: right;"
aria-hidden="true"></i>
<h4 class="AreaCapture-lassoInstruction-header">Create ellipses:</h4>
<div class="AreaCapture-dialog-container">
<p class="AreaCapture-text" style="display: inline;">
Year:
<input id="AreaCapture-newYear-input"
class="AreaCapture-input"
type="number"
placeholder="{{ year }}">

<div style="display: inline;">
<i id="AreaCapture-confirmYear-btn"
class="fa fa-check-square"
style="font-size: 16px;"
aria-hidden="true"></i>
</div>
</p>
</div>
<div class="AreaCapture-btn-row">
Expand Down Expand Up @@ -36,30 +43,6 @@
</div>
</script>

<script id="AreaCapture-newYearDialog-template" type="text/x-handlebars-template">
<div class="AreaCapture-dialog-container">
<p class="AreaCapture-text">
Year:
<input id="AreaCapture-newYear-input"
class="AreaCapture-input"
type="number"
placeholder="{{ year }}">

<div style="margin-top: 4px;">
<i id="AreaCapture-confirmYear-btn"
class="fa fa-check-square"
style="font-size: 16px;"
aria-hidden="true"></i>

<p class="AreaCapture-subtext"
style="display: inline;">
Shift - 2
</p>
</div>
</p>
</div>
</script>

<script id="AreaCapture-deleteSelectedEllipsesDialog-template" type="text/x-handlebars-template">
<div class="AreaCapture-dialog-container">
<div class="AreaCapture-deleteWarning-container">
Expand Down
4 changes: 0 additions & 4 deletions assets/leaflet-treering/leaflet-treering.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ function LTreering (viewer, basePath, options, base_layer, gl_layer, fullJSON) {
this.tools.push(...this.datingInterface.tools);

// --- //
// Code hosted in Leaflet.AreaCapture.js
this.areaCaptureInterface = new AreaCaptureInterface(this);
this.areaTools = new ButtonBar(this, this.areaCaptureInterface.btns, 'hdr_strong', 'Manage ellipses');
this.tools.push(...this.areaCaptureInterface.tools);
// Code hosted in Leaflet.PithEstimate.js
this.pithEstimateInterface = new PithEstimateInterface(this);
let createToolArr = [this.createPoint.btn, this.mouseLine.btn, this.zeroGrowth.btn, this.createBreak.btn];
Expand Down

0 comments on commit 76d2a39

Please sign in to comment.