Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
PrafulB committed Jan 31, 2024
1 parent 1023837 commit 804ec01
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 8 deletions.
31 changes: 24 additions & 7 deletions drawCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,6 @@ function drawCoresOnCanvasForTravelingAlgorithm() {
if (!e.shift) {
overlay.element.style.cursor = "grabbing"
overlay.update(overlay.location.plus(delta))

} else {
overlay.element.style.cursor = "nwse-resize"
let {width, height} = overlay.bounds
Expand All @@ -479,11 +478,13 @@ function drawCoresOnCanvasForTravelingAlgorithm() {
}

overlay.drawHTML(overlay.element.parentElement, window.viewer.viewport)

const deltaPosInImageCoords = window.viewer.viewport.viewportToImageCoordinates(delta)
if (index !== -1) {
window.sortedCoresData[index].x += deltaPosInImageCoords.x
window.sortedCoresData[index].y += deltaPosInImageCoords.y
document.getElementById("editXInput").value = window.sortedCoresData[index].x
document.getElementById("editYInput").value = window.sortedCoresData[index].y

connectAdjacentCores(window.sortedCoresData[index], true)
}
Expand Down Expand Up @@ -930,10 +931,21 @@ function drawCoresOnCanvasForTravelingAlgorithm() {
});
}

document
.getElementById("osdViewerAddCoreBtn")
.addEventListener("click", function (e) {
const addCoreBtn = document.getElementById("osdViewerAddCoreBtn")
const addCoreHandler = (e) => {

const addCoreBtn = document.getElementById("osdViewerAddCoreBtn")
if (addCoreBtn.classList.contains("active")) {
addCoreBtn.classList.remove("active")
window.viewer.canvas.style.cursor = "auto"
window.viewer.removeAllHandlers("canvas-drag")
window.viewer.removeAllHandlers("canvas-drag-end")
} else {
document.addEventListener("keydown", (e) => {
e.preventDefault()
if (e.key === 'Escape') {
addCoreHandler()
}
})
addCoreBtn.classList.add("active")
window.viewer.canvas.style.cursor = "crosshair"

Expand Down Expand Up @@ -980,8 +992,13 @@ function drawCoresOnCanvasForTravelingAlgorithm() {
updateSidebar(core);
positionSidebarNextToCore(e.originalEvent);
})
}

});
}

document
.getElementById("osdViewerAddCoreBtn")
.addEventListener("click", addCoreHandler)

// document
// .getElementById("addCoreButton")
Expand Down
11 changes: 10 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,9 @@ function bindEventListeners() {
button.addEventListener("click", function () {
const sidebar = this.closest(".edit-sidebar");
sidebar.style.display = "none"; // You can toggle visibility or minimize the sidebar as required
window.viewer.currentOverlays.forEach(o => {
o.element.classList.remove("selected")
})
});
});

Expand Down Expand Up @@ -745,7 +748,7 @@ const initSegmentation = async () => {
}
document.getElementById("osdViewer").style.width = `${window.loadedImg.getAttribute("width")}px`
document.getElementById("osdViewer").style.height = `${window.loadedImg.getAttribute("height")}px`

window.viewer?.destroy()
window.viewer = OpenSeadragon({
id: "osdViewer",
visibilityRatio: 1,
Expand Down Expand Up @@ -861,6 +864,12 @@ const initSegmentation = async () => {
});
};

document.querySelectorAll("input[type='number']").forEach(e => {
e.onwheel = (e) => {
e.preventDefault()
}
})

function moveToCarouselItem(direction) {
var current = document.querySelector(".carousel-item.active");
var items = document.querySelectorAll(".carousel-item");
Expand Down
1 change: 1 addition & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ nav ul li a:hover {
background-color: #f9f9f9;
color: #555;
}

/* Spacing around sections */
.hyperparameters, .file-upload-container, .tabcontent, .instructions-container {
margin-bottom: 20px; /* Consistent bottom spacing */
Expand Down

0 comments on commit 804ec01

Please sign in to comment.