Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to change an opacity for selected shapes #77

Merged
merged 3 commits into from
Sep 21, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions cvat/apps/engine/static/engine/js/shapeCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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;
bsekachev marked this conversation as resolved.
Show resolved Hide resolved

for (let view of this._currentViews) {
view.updateColorSettings(this._colorSettings);
}
});

this._blackStrokeCheckbox.on('click', (e) => {
this._colorSettings["black-stroke"] = e.target.checked;

Expand Down
6 changes: 5 additions & 1 deletion cvat/apps/engine/static/engine/js/shapes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ class ShapeView extends Listener {
this._appearance = {
colors: shapeModel.color,
fillOpacity: 0,
selectedFillOpacity: 0.1,
selectedFillOpacity: 0.2,
};

this._flags = {
Expand Down Expand Up @@ -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';
}
Expand Down
9 changes: 5 additions & 4 deletions cvat/apps/engine/templates/engine/annotation.html
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,17 @@
<hr>
<table class="regular" cellpadding="20">
<tr>
<td>
<td style="width: auto;">
<div style="float: left;"> <label class="semiBold"> Fill Opacity: </label> </div>
<div style="float: left; margin-left: 1em;"> <input type="range" min="-5" max="5" value="0" id="fillOpacityRange"/> </div>
</td>
<td style="width: auto;">
<div style="float: left;"> <label class="semiBold"> Black Stroke: </label> </div>
<div style="float: left; margin-left: 1em;"> <input type="checkbox" id="blackStrokeCheckbox" class="settingsBox"/> </div>
<div style="float: left;"> <label class="semiBold"> Selected Fill Opacity: </label> </div>
<div style="float: left; margin-left: 1em;"> <input type="range" min="0" max="5" value="1" id="selectedFillOpacityRange"/> </div>
bsekachev marked this conversation as resolved.
Show resolved Hide resolved
</td>
<td style="width: auto;">

<div style="float: left;"> <label class="semiBold"> Black Stroke: </label> </div>
<div style="float: left; margin-left: 1em;"> <input type="checkbox" id="blackStrokeCheckbox" class="settingsBox"/> </div>
</td>
<td style="width: auto;">
<div style="float: left;"> <label class="semiBold"> Color by: </label> </div>
Expand Down