Skip to content

Commit

Permalink
Merge pull request #144 from UMN-LATIS/Ellipse-Hot-Fix
Browse files Browse the repository at this point in the history
Ellipse hot fix
  • Loading branch information
cmcfadden authored Nov 9, 2023
2 parents 91d4505 + d0754db commit f5cd84f
Show file tree
Hide file tree
Showing 6 changed files with 294 additions and 531 deletions.
29 changes: 19 additions & 10 deletions Leaflet.AreaCapture.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,15 @@ function EllipseData(Inte) {
Inte.ellipseVisualAssets.reload();
}

/**
* Clear JSON data.
* @function
*/
EllipseData.prototype.clearJSON = function() {
this.data = [];
this.reloadJSON();
}

/**
* Undo recent changes.
* @function
Expand Down Expand Up @@ -502,9 +511,9 @@ function NewEllipse(Inte) {
() => { this.disable() },
);

// Crtl-E to create a new ellipse.
// Shift-E to create a new ellipse.
L.DomEvent.on(window, 'keydown', (e) => {
if (e.keyCode == 69 && e.getModifierState("Control") && window.name.includes('popout')) {
if (e.keyCode == 69 && e.getModifierState("Shift") && !e.getModifierState("Control") && window.name.includes('popout')) {
e.preventDefault();
e.stopPropagation();
Inte.treering.disableTools();
Expand Down Expand Up @@ -627,8 +636,8 @@ function NewEllipse(Inte) {
* @param {object} Inte - AreaCaptureInterface object. Allows access to all other tools.
*/
function NewEllipseDialog(Inte) {
let minWidth = 170;
let minHeight = 115;
let minWidth = 130;
let minHeight = 130;
this.size = [minWidth, minHeight];
this.anchor = [50, 0];

Expand Down Expand Up @@ -733,18 +742,18 @@ function NewEllipseDialog(Inte) {
* @function
*/
NewEllipseDialog.prototype.createShortcutEventListeners = function () {
// Keyboard short cut for subtracting year: Ctrl - 1
// Keyboard short cut for subtracting year: Shift - 1
L.DomEvent.on(window, 'keydown', (e) => {
if (e.keyCode == 49 && !e.shiftKey && e.ctrlKey && this.dialogOpen) {
if (e.keyCode == 49 && e.shiftKey && !e.ctrlKey && this.dialogOpen) {
Inte.ellipseData.decreaseYear();
Inte.ellipseVisualAssets.cycleColorsDown();
this.update();
}
}, this);

// Keyboard short cut for confirming a new year: Ctrl - 2
// Keyboard short cut for confirming a new year: Shift - 2
L.DomEvent.on(window, 'keydown', (e) => {
if (e.keyCode == 50 && !e.shiftKey && e.ctrlKey && this.dialogOpen) {
if (e.keyCode == 50 && e.shiftKey && !e.ctrlKey && this.dialogOpen) {
let year = $("#AreaCapture-newYear-input").val();
if (year || year == 0) {
Inte.ellipseVisualAssets.cycleColorsMulti(year);
Expand All @@ -754,9 +763,9 @@ function NewEllipseDialog(Inte) {
}
}, this);

// Keyboard short cut for adding year: Ctrl - 3
// Keyboard short cut for adding year: Shift - 3
L.DomEvent.on(window, 'keydown', (e) => {
if (e.keyCode == 51 && !e.shiftKey && e.ctrlKey && this.dialogOpen) {
if (e.keyCode == 51 && e.shiftKey && !e.ctrlKey && this.dialogOpen) {
Inte.ellipseData.increaseYear();
Inte.ellipseVisualAssets.cycleColorsUp();
this.update();
Expand Down
Loading

0 comments on commit f5cd84f

Please sign in to comment.