From f46fcebf9a34e8e826fcb877abd7dbc61970564c Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Fri, 21 Sep 2018 09:01:21 +0300 Subject: [PATCH 1/3] Feature has been implemented: ability to change selected opacity for shapes --- cvat/apps/engine/static/engine/js/shapeCollection.js | 11 +++++++++++ cvat/apps/engine/static/engine/js/shapes.js | 6 +++++- cvat/apps/engine/templates/engine/annotation.html | 9 +++++---- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/cvat/apps/engine/static/engine/js/shapeCollection.js b/cvat/apps/engine/static/engine/js/shapeCollection.js index 67cbc9ee4585..6c0d186b7066 100644 --- a/cvat/apps/engine/static/engine/js/shapeCollection.js +++ b/cvat/apps/engine/static/engine/js/shapeCollection.js @@ -999,6 +999,7 @@ class ShapeCollectionView { this._labelsContent = $('#labelsContent'); this._showAllInterpolationBox = $('#showAllInterBox'); this._fillOpacityRange = $('#fillOpacityRange'); + this._selectedFillOpacityRange = $('#selectedFillOpacityRange'); this._blackStrokeCheckbox = $('#blackStrokeCheckbox'); this._colorByInstanceRadio = $('#colorByInstanceRadio'); this._colorByGroupRadio = $('#colorByGroupRadio'); @@ -1037,6 +1038,16 @@ class ShapeCollectionView { } }); + this._selectedFillOpacityRange.on('input', (e) => { + let value = Math.clamp(+e.target.value, +e.target.min, +e.target.max); + e.target.value = value; + this._colorSettings["selected-fill-opacity"] = value / 5; + + for (let view of this._currentViews) { + view.updateColorSettings(this._colorSettings); + } + }); + this._blackStrokeCheckbox.on('click', (e) => { this._colorSettings["black-stroke"] = e.target.checked; diff --git a/cvat/apps/engine/static/engine/js/shapes.js b/cvat/apps/engine/static/engine/js/shapes.js index 5f85904a12e1..9c61f930dc7b 100644 --- a/cvat/apps/engine/static/engine/js/shapes.js +++ b/cvat/apps/engine/static/engine/js/shapes.js @@ -1400,7 +1400,7 @@ class ShapeView extends Listener { this._appearance = { colors: shapeModel.color, fillOpacity: 0, - selectedFillOpacity: 0.1, + selectedFillOpacity: 0.2, }; this._flags = { @@ -2645,6 +2645,10 @@ class ShapeView extends Listener { } } + if ('selected-fill-opacity' in settings) { + this._appearance.selectedFillOpacity = settings['selected-fill-opacity']; + } + if (settings['black-stroke']) { this._appearance['stroke'] = 'black'; } diff --git a/cvat/apps/engine/templates/engine/annotation.html b/cvat/apps/engine/templates/engine/annotation.html index 33dea2ad459c..edf38e68805c 100644 --- a/cvat/apps/engine/templates/engine/annotation.html +++ b/cvat/apps/engine/templates/engine/annotation.html @@ -142,16 +142,17 @@
-
+
-
-
+
+
- +
+
From fdb7aa1358b3ca04cfd7ba63a3b7156c0cf49b45 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Fri, 21 Sep 2018 10:07:10 +0300 Subject: [PATCH 2/3] Extra code has been removed --- cvat/apps/engine/static/engine/js/base.js | 2 +- cvat/apps/engine/static/engine/js/shapeFilter.js | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/cvat/apps/engine/static/engine/js/base.js b/cvat/apps/engine/static/engine/js/base.js index e5d59c99dda4..a164e3cd61a7 100644 --- a/cvat/apps/engine/static/engine/js/base.js +++ b/cvat/apps/engine/static/engine/js/base.js @@ -216,7 +216,7 @@ $.ajaxSetup({ $(document).ready(function(){ $('body').css({ - width: window.screen.width * 0.95 + 'px', + width: window.screen.width + 'px', height: window.screen.height * 0.95 + 'px' }); }); diff --git a/cvat/apps/engine/static/engine/js/shapeFilter.js b/cvat/apps/engine/static/engine/js/shapeFilter.js index eeb67066dd68..36d86d2c66cc 100644 --- a/cvat/apps/engine/static/engine/js/shapeFilter.js +++ b/cvat/apps/engine/static/engine/js/shapeFilter.js @@ -70,10 +70,6 @@ class FilterModel { this._update(); } } - - get filterRow() { - return this._filter; - } } class FilterController { @@ -102,10 +98,6 @@ class FilterController { deactivate() { this._model.active = false; } - - get filterRow() { - return this._model.filterRow; - } } From 286eaa042d83106df29cc1570c95b4c5e7033672 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Fri, 21 Sep 2018 16:58:58 +0300 Subject: [PATCH 3/3] Floats used in ranges --- cvat/apps/engine/static/engine/js/shapeCollection.js | 6 +++--- cvat/apps/engine/templates/engine/annotation.html | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cvat/apps/engine/static/engine/js/shapeCollection.js b/cvat/apps/engine/static/engine/js/shapeCollection.js index 6c0d186b7066..d9132b9de310 100644 --- a/cvat/apps/engine/static/engine/js/shapeCollection.js +++ b/cvat/apps/engine/static/engine/js/shapeCollection.js @@ -1021,7 +1021,7 @@ class ShapeCollectionView { let value = Math.clamp(+e.target.value, +e.target.min, +e.target.max); e.target.value = value; if (value >= 0) { - this._colorSettings["fill-opacity"] = value / 5; + this._colorSettings["fill-opacity"] = value; delete this._colorSettings['white-opacity']; for (let view of this._currentViews) { @@ -1030,7 +1030,7 @@ class ShapeCollectionView { } else { value *= -1; - this._colorSettings["white-opacity"] = value / 5; + this._colorSettings["white-opacity"] = value; for (let view of this._currentViews) { view.updateColorSettings(this._colorSettings); @@ -1041,7 +1041,7 @@ class ShapeCollectionView { this._selectedFillOpacityRange.on('input', (e) => { let value = Math.clamp(+e.target.value, +e.target.min, +e.target.max); e.target.value = value; - this._colorSettings["selected-fill-opacity"] = value / 5; + this._colorSettings["selected-fill-opacity"] = value; for (let view of this._currentViews) { view.updateColorSettings(this._colorSettings); diff --git a/cvat/apps/engine/templates/engine/annotation.html b/cvat/apps/engine/templates/engine/annotation.html index edf38e68805c..0042b798f1ae 100644 --- a/cvat/apps/engine/templates/engine/annotation.html +++ b/cvat/apps/engine/templates/engine/annotation.html @@ -144,11 +144,11 @@
-
+
-
+