From b1da7fb1d2e0a1bfec1e46ecedd01572deb9a3e5 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Wed, 13 Feb 2019 18:44:06 +0300 Subject: [PATCH 1/3] Box size is shown always --- cvat/apps/engine/static/engine/js/annotationUI.js | 2 +- cvat/apps/engine/static/engine/js/shapes.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cvat/apps/engine/static/engine/js/annotationUI.js b/cvat/apps/engine/static/engine/js/annotationUI.js index 1c1471f225c0..507975a5c602 100644 --- a/cvat/apps/engine/static/engine/js/annotationUI.js +++ b/cvat/apps/engine/static/engine/js/annotationUI.js @@ -660,7 +660,7 @@ function setupMenu(job, shapeCollectionModel, annotationParser, aamModel, player function drawBoxSize(boxScene, textScene, box) { let clientBox = window.cvat.translate.box.canvasToClient(boxScene.node, box); - let text = `${box.width.toFixed(1)}x${box.height.toFixed(1)}`; + let text = `${Math.round(box.width)}x${Math.round(box.height)}`; let obj = this && this.textUI && this.rm ? this : { textUI: textScene.text('').font({ weight: 'bolder' diff --git a/cvat/apps/engine/static/engine/js/shapes.js b/cvat/apps/engine/static/engine/js/shapes.js index 85101f557776..ec041452c940 100644 --- a/cvat/apps/engine/static/engine/js/shapes.js +++ b/cvat/apps/engine/static/engine/js/shapes.js @@ -2438,7 +2438,6 @@ class ShapeView extends Listener { } } - // Inteface methods draw(interpolation) { let outside = interpolation.position.outside; @@ -2460,7 +2459,6 @@ class ShapeView extends Listener { this._setupLockedUI(this._controller.lock); } - erase() { this._removeShapeUI(); this._removeShapeText(); @@ -2792,6 +2790,14 @@ class BoxView extends ShapeView { this._uis.boxSize = null; } + _drawShapeText() { + ShapeView.prototype._drawShapeText.call(this); + if (this._uis.shape && this._uis.text) { + const box = this._uis.shape.node.getBBox(); + const size = `${Math.round(box.width)}x${Math.round(box.height)}`; + this._uis.text.node.children[0].innerHTML += ` [${size}]` + } + } _makeEditable() { if (this._uis.shape && this._uis.shape.node.parentElement && !this._flags.editable) { From 500a35ae4caaeafb4d91bc8a1580aebf9ddc08d6 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Wed, 13 Feb 2019 18:48:30 +0300 Subject: [PATCH 2/3] Drawn attributes --- cvat/apps/engine/static/engine/js/shapes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cvat/apps/engine/static/engine/js/shapes.js b/cvat/apps/engine/static/engine/js/shapes.js index ec041452c940..e5877e2b4cc1 100644 --- a/cvat/apps/engine/static/engine/js/shapes.js +++ b/cvat/apps/engine/static/engine/js/shapes.js @@ -2790,8 +2790,8 @@ class BoxView extends ShapeView { this._uis.boxSize = null; } - _drawShapeText() { - ShapeView.prototype._drawShapeText.call(this); + _drawShapeText(attributes) { + ShapeView.prototype._drawShapeText.call(this, attributes); if (this._uis.shape && this._uis.text) { const box = this._uis.shape.node.getBBox(); const size = `${Math.round(box.width)}x${Math.round(box.height)}`; From 0b0c25a0dceb75eff5c93f6f3ff5cf6d59108224 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Wed, 13 Feb 2019 18:53:58 +0300 Subject: [PATCH 3/3] Changed size separator --- cvat/apps/engine/static/engine/js/annotationUI.js | 2 +- cvat/apps/engine/static/engine/js/shapes.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cvat/apps/engine/static/engine/js/annotationUI.js b/cvat/apps/engine/static/engine/js/annotationUI.js index 507975a5c602..92a6adb8da40 100644 --- a/cvat/apps/engine/static/engine/js/annotationUI.js +++ b/cvat/apps/engine/static/engine/js/annotationUI.js @@ -660,7 +660,7 @@ function setupMenu(job, shapeCollectionModel, annotationParser, aamModel, player function drawBoxSize(boxScene, textScene, box) { let clientBox = window.cvat.translate.box.canvasToClient(boxScene.node, box); - let text = `${Math.round(box.width)}x${Math.round(box.height)}`; + let text = `${Math.round(box.width)}\u2715${Math.round(box.height)}`; let obj = this && this.textUI && this.rm ? this : { textUI: textScene.text('').font({ weight: 'bolder' diff --git a/cvat/apps/engine/static/engine/js/shapes.js b/cvat/apps/engine/static/engine/js/shapes.js index e5877e2b4cc1..290ece7efcc7 100644 --- a/cvat/apps/engine/static/engine/js/shapes.js +++ b/cvat/apps/engine/static/engine/js/shapes.js @@ -2794,7 +2794,7 @@ class BoxView extends ShapeView { ShapeView.prototype._drawShapeText.call(this, attributes); if (this._uis.shape && this._uis.text) { const box = this._uis.shape.node.getBBox(); - const size = `${Math.round(box.width)}x${Math.round(box.height)}`; + const size = `${Math.round(box.width)}\u2715${Math.round(box.height)}`; this._uis.text.node.children[0].innerHTML += ` [${size}]` } }