Skip to content

Commit

Permalink
Some AAM refactoring #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Boris Sekachev committed Oct 15, 2018
1 parent 53888e3 commit 2d0f226
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
13 changes: 1 addition & 12 deletions cvat/apps/engine/static/engine/js/attributeAnnotationMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,13 @@ class AAMModel extends Listener {
if (this._activeAAM && this._active) {
let label = this._active.label;
let attrId = +this._attrIdByIdx(label, this._attrNumberByLabel[label].current);
let attrInfo = window.cvat.labelsInfo.attrInfo(attrId);

let [xtl, ytl, xbr, ybr] = this._bbRect(this._currentShapes[this._activeIdx].interpolation.position);
this._focus(xtl - this._margin, xbr + this._margin, ytl - this._margin, ybr + this._margin);

this._active.activeAttribute = attrId;

this.notify();

if (attrInfo.type === 'text' || attrInfo.type === 'number') {
this._active.aamAttributeFocus();
}
}
else {
this.notify();
}
this.notify();
}

_deactivate() {
Expand Down Expand Up @@ -384,7 +375,5 @@ class AAMView {
this._trackManagement.removeClass('hidden');
}
}
// blur on change text attribute to other or on exit from aam
blurAllElements();
}
}
19 changes: 9 additions & 10 deletions cvat/apps/engine/static/engine/js/shapes.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,6 @@ class ShapeModel extends Listener {
return frame in this._positions;
}

aamAttributeFocus() {
this.notify('attributeFocus');
}

select() {
if (!this._selected) {
this._selected = true;
Expand Down Expand Up @@ -2509,19 +2505,22 @@ class ShapeView extends Listener {
this.notify('changelabel');
break;
}
case 'attributeFocus': {
let attrId = model.activeAAM.attributeId;
this._uis.attributes[attrId].focus();
this._uis.attributes[attrId].select();
break;
}
case 'activeAttribute':
this._setupAAMView(activeAAM.shape, interpolation.position);
setupHidden.call(this, hiddenShape, hiddenText, activeAAM, model.active, interpolation);

if (activeAAM.shape && this._uis.shape) {
this._uis.shape.node.dispatchEvent(new Event('click'));
this._highlightAttribute(activeAAM.attributeId);

let attrInfo = window.cvat.labelsInfo.attrInfo(activeAAM.attributeId);
if (attrInfo.type === 'text' || attrInfo.type === 'number') {
this._uis.attributes[activeAAM.attributeId].focus();
this._uis.attributes[activeAAM.attributeId].select();
}
else {
blurAllElements();
}
}
else {
this._highlightAttribute(null);
Expand Down

0 comments on commit 2d0f226

Please sign in to comment.