Skip to content

Commit

Permalink
Add goto annnotation, remove id and position
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmartel committed Jan 9, 2025
1 parent 86298e9 commit b36c7e6
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/gui/generic.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,6 @@ dwvjq.gui.DrawList = function (app) {
for (var i = 0; i < annotations.length; ++i) {
var annotation = annotations[i];
var simpleDetail = {
id: annotation.id,
position: '',
type: capitalizeFirstLetter(annotation.getFactory().getName()),
color: annotation.colour,
description: annotation.textExpr
Expand All @@ -380,9 +378,9 @@ dwvjq.gui.DrawList = function (app) {
table.className = 'drawsTable';

// cell indices
var shapeCellIndex = 2;
var colorCellIndex = 3;
var descCellIndex = 4;
var shapeCellIndex = 0;
var colorCellIndex = shapeCellIndex + 1;
var descCellIndex = colorCellIndex + 1;

// optional gui specific table post process
dwvjq.gui.postProcessTable(table);
Expand Down Expand Up @@ -492,12 +490,6 @@ dwvjq.gui.DrawList = function (app) {
);
}
} else {
// id: link to image
cells[0].onclick = createRowOnClick(
cells[0].firstChild.data
);
cells[0].onmouseover = dwvjq.html.setCursorToPointer;
cells[0].onmouseout = dwvjq.html.setCursorToDefault;
// color: just display the input color with no callback
if (c === colorCellIndex) {
dwvjq.html.makeCellEditable(cells[c], null, 'color');
Expand All @@ -507,20 +499,29 @@ dwvjq.gui.DrawList = function (app) {

// append actions
var cell0 = row.insertCell(0);
// goto
var gotoSpan = document.createElement('span');
gotoSpan.className = 'text-button checked';
gotoSpan.title = 'Goto annotation';
gotoSpan.appendChild(document.createTextNode('\u{1F3AF}')); // target
gotoSpan.onclick = createRowOnClick(annot.id);
cell0.appendChild(gotoSpan);
// visibility
var visibilitySpan = document.createElement('span');
if (drawLayer.isAnnotationVisible(annot.id)) {
visibilitySpan.className = 'text-button checked';
} else {
visibilitySpan.className = 'text-button unchecked';
}
visibilitySpan.title = 'Show/hide';
visibilitySpan.appendChild(document.createTextNode('\u{1F441}')); // eye
visibilitySpan.onclick =
createVisibleOnClick(annot, visibilitySpan);
cell0.appendChild(visibilitySpan);
// delete
var deleteSpan = document.createElement('span');
deleteSpan.className = 'text-button checked';
deleteSpan.title = 'Delete annotation';
deleteSpan.appendChild(document.createTextNode('\u{274C}')); // cross
deleteSpan.onclick = createDeleteOnClick(annot, deleteSpan);
cell0.appendChild(deleteSpan);
Expand Down

0 comments on commit b36c7e6

Please sign in to comment.