Skip to content

Commit 6b8c9b1

Browse files
Merge pull request #214 from SenteraLLC/fix/vanish-cookie
[PLAT-1079] Fix/vanish cookie
2 parents 55a20f6 + 4023195 commit 6b8c9b1

8 files changed

Lines changed: 31 additions & 10 deletions

File tree

.github/workflows/lint.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: Lint
33
on:
44
workflow_dispatch:
55
pull_request:
6+
types:
7+
- opened
8+
- synchronize
69
push:
710
branches:
811
- main

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ All notable changes to this project will be documented here.
66

77
Nothing yet.
88

9+
## [0.16.3] - Apr 25th, 2025
10+
- Fix bug where the `Vanish` button wouldn't update its `locked` state when switching between subtasks.
11+
- Fix bug where clicking the `Vanish` button would unexpectedly set the size cookie, causing future annotations in the same subtask to be loaded in a very small size on subsequent sessions, with the only way to recover being to increase the annotation size.
12+
913
## [0.16.2] - Apr 2nd, 2025
1014
- Fixed bug introduced in v0.15.0 where using the erase tool such that a polygon was separated into multiple disjoint regions would cause an unrecoverable error.
1115

dist/ulabel.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ulabel.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ulabel",
33
"description": "An image annotation tool.",
4-
"version": "0.16.2",
4+
"version": "0.16.3",
55
"main": "dist/ulabel.js",
66
"module": "dist/ulabel.js",
77
"scripts": {

src/toolbox.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ enum ValidResizeValues {
3535
}
3636

3737
const toolboxDividerDiv = "<div class=toolbox-divider></div>";
38+
const vanish_size = 0.01;
3839

3940
/** Chains the replaceAll method and the toLowerCase method.
4041
* Optionally concatenates a string at the end of the method.
@@ -1328,7 +1329,6 @@ export class AnnotationResizeItem extends ToolboxItem {
13281329
const small_size = 1.5;
13291330
const large_size = 5;
13301331
const increment_size = 0.5;
1331-
const vanish_size = 0.01;
13321332
const subtask_cached_size = subtask.display_name.replaceLowerConcat(" ", "-", "-cached-size");
13331333
const subtask_vanished_flag = subtask.display_name.replaceLowerConcat(" ", "-", "-vanished");
13341334

@@ -1408,8 +1408,8 @@ export class AnnotationResizeItem extends ToolboxItem {
14081408
case "-":
14091409
// Check to make sure annotation line size won't go 0 or negative.
14101410
// If it would, set it equal to a small positive number
1411-
if (subtask.annotations.access[annotation_id].line_size - size <= 0.01) {
1412-
subtask.annotations.access[annotation_id].line_size = 0.01;
1411+
if (subtask.annotations.access[annotation_id].line_size - size <= vanish_size) {
1412+
subtask.annotations.access[annotation_id].line_size = vanish_size;
14131413
} else {
14141414
subtask.annotations.access[annotation_id].line_size -= size;
14151415
}
@@ -1420,7 +1420,10 @@ export class AnnotationResizeItem extends ToolboxItem {
14201420
}
14211421

14221422
if (subtask.annotations.ordering.length > 0) {
1423-
this.set_size_cookie(subtask.annotations.access[subtask.annotations.ordering[0]].line_size, subtask);
1423+
const line_size = subtask.annotations.access[subtask.annotations.ordering[0]].line_size;
1424+
if (line_size !== vanish_size) {
1425+
this.set_size_cookie(line_size, subtask);
1426+
}
14241427
}
14251428
}
14261429

@@ -1431,6 +1434,17 @@ export class AnnotationResizeItem extends ToolboxItem {
14311434
}
14321435
}
14331436

1437+
public redraw_update(ulabel: ULabel): void {
1438+
// Ensure the vanish button reflects the vanish state of the current subtask
1439+
const current_subtask = ulabel.get_current_subtask();
1440+
const subtask_vanished_flag = current_subtask.display_name.replaceLowerConcat(" ", "-", "-vanished");
1441+
if (this[subtask_vanished_flag]) {
1442+
$("#annotation-resize-v").addClass("locked");
1443+
} else {
1444+
$("#annotation-resize-v").removeClass("locked");
1445+
}
1446+
}
1447+
14341448
private set_size_cookie(cookie_value, subtask) {
14351449
const d = new Date();
14361450
d.setTime(d.getTime() + (10000 * 24 * 60 * 60 * 1000));

src/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const ULABEL_VERSION = "0.16.2";
1+
export const ULABEL_VERSION = "0.16.3";

0 commit comments

Comments
 (0)