Skip to content

Commit

Permalink
feat: support region labeling (microsoft#481)
Browse files Browse the repository at this point in the history
* feat: support region labeling

* fix: check temporarily for drawn region features before remove

* fix: delete drawn region from current assest on delete

* fix: use clockwise coordinates for boundingbox

* feat: support modify cancell

* fix: remove missing props from merge conflict

* fix: resolve tsling check

* fix: resolve tslint check

* refactor: add strings

* fix: support key labeling

* feat: add drawn region to keyboard shortcuts

* feat: support labelType in label JSON files

* fix: support layer sync

* refactor: remove console logs for debugging

* fix: support clearing drawnRegions on next page

* docs: add test cases

* fix: disable feature until back-end support
  • Loading branch information
stew-ro authored Aug 24, 2020
1 parent 65fc92b commit dd78ed0
Show file tree
Hide file tree
Showing 18 changed files with 1,918 additions and 737 deletions.
159 changes: 150 additions & 9 deletions docs/manual_testing/manual-test-runbook.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,149 @@
# Test Runbook

## **Feat: support region labeling**

> ### Feature description ###
- Add a draw region button to the canvas commandbar in the editor page

> ### Use Case ###
**As** a user
**I want** draw regions to label in the editor page
**So** I can label regions that are not recognized by OCR

> ### Acceptance criteria ###
#### Scenario One ####
**Given** I'm on the editor page and click the draw region botton on the canvas commandbar
**When** I hover the pointer over the current document image
**Then** I should see the cursor change to a crosshair

#### Scenario Two ####

**Given** I'm on the editor page and click the draw region botton on the canvas commandbar
**When** I click the layer botton on the canvas commandbar
**Then** I should see the drawn regions layer disabled in the canvas commandbar

#### Scenario Three ####

**Given** I'm on the editor page
**When** I click the layer botton on the canvas commandbar
**Then** I should see the drawn regions layer enabled in the canvas commandbar

#### Scenario Four ####

**Given** I'm on the editor page and click the draw region botton on the canvas commandbar
**When** I click and drag on the document image
**Then** I should see a region being drawn

#### Scenario Five ####

**Given** I'm on the editor page and click the draw region botton on the canvas commandbar
**When** I click and drag outside of the document image
**Then** I should see the document panned

#### Scenario Six ####

**Given** I'm on the editor page and click the draw region botton on the canvas commandbar
**When** I click and drag on the document image to outside of the document image
**Then** I should see a region being drawn and then cancelled

#### Scenario Seven ####

**Given** I'm on the editor page and click the draw region botton on the canvas commandbar
**When** I finish drawing a region
**Then** I should see a drawn region that is selected

#### Scenario Eight ####

**Given** I'm on the editor page and click the draw region botton on the canvas commandbar
**When** I click on the draw region button again
**Then** I should see the cursor return to a pointer while hovering the document image

#### Scenario Nine ####

**Given** I've drawn regions
**When** I hover a region's vertex
**Then** I should see a move icon apear on the vertex and the cursor change to grab

#### Scenario Ten ####

**Given** I've drawn regions
**When** I hover a region's vertex, click, and hold
**Then** I should see the cursor change to grabbing and the vertex should move with cursor

#### Scenario Eleven ####

**Given** I've drawn regions
**When** I hover a region's vertex, click, hold, and drag outside of the document image
**Then** I should see the vertex return to it's original position

#### Scenario Twelve ####

**Given** I've drawn regions
**When** I hover a region's vertex, click, hold, drag, and click the Escape or Backspace key
**Then** I should see the vertex return to it's original position

#### Scenario Thirteen ####

**Given** I'm on the editor page and click the draw region botton on the canvas commandbar
**When** I click on the document image, hold, drag, and click the Escape or Backspace key
**Then** I should see the drawing cancelled

#### Scenario Fourteen ####

**Given** I've drawn regions
**When** I exit draw region mode and click drawn regions
**Then** I should see the drawn regions toggle between selected and unselected

#### Scenario Fifteen ####

**Given** I've drawn regions
**When** I exit draw region mode
**Then** I should see the drawn regions still be reshapable

#### Scenario Sixteen ####

**Given** I've selected drawn regions
**When** I click an empty tag or a tag with only drawn region values already applied or press it's hot key
**Then** I should see the drawn region applied as a label for the tag

#### Scenario Seventeen ####

**Given** I've selected drawn regions
**When** I click a tag with text or checkbox values or press it's hot key
**Then** I should see a message letting me know I can't apply the drawn region to the tag

#### Scenario Eighteen ####

**Given** I've labeled drawn regions
**When** I view the label json file
**Then** I should see the drawn region labeled with a clockwise bounding box

#### Scenario Nineteen ####

**Given** I've labeled drawn regions
**When** I hover the cursor over a label vertex
**Then** I should see the vertex should be movable

#### Scenario Twenty ####

**Given** I've labeled drawn regions
**When** I hover the cursor over a label vertex
**Then** I should see the vertex should be movable

#### Scenario Twentyone ####

**Given** I've labeled drawn regions
**When** I hover the cursor over a label vertex and move it
**Then** I should see the label reshaped in the document image and the json file

#### Scenario Twentytwo ####

**Given** I've selected drawn regions
**When** I press alt-backspace
**Then** I should see the selected regions should be deleted

## **Feat: support adding models to project's recent models from the model compose page**

> ### Feature description ###
Expand Down Expand Up @@ -44,20 +188,17 @@

> ### Use Case ###
**`I want`** I want to know the models been used to compose a model
**`So`** I can double click that model to invoke the pop up and checkout models been used

**`Given`** I've opened a project containing documents and I'm on the Model Compose page
**`When`** I double click a row with composed model
**`Then`** I should see a pop up, which it shows all models we used to compose in the list. Beside, there is also a filter field in the top to filter a specific model out of the list
**As** a user
**I want** I want to know the models been used to compose a model
**So** I can double click that model to invoke the pop up and checkout models been used

> ### Acceptance criteria ###
#### Scenario One ####

**`Given`** I've opened a project containing documents and I'm on the Model Compose page
**`When`** I double click a row with composed model
**`Then`** I should see a pop up, which it shows all models we used to compose in the list. Beside, there is also a filter field in the top to filter a specific model out of the list
**Given** I've opened a project containing documents and I'm on the Model Compose page
**When`** I double click a row with composed model
**Then** I should see a pop up, which it shows all models we used to compose in the list. Beside, there is also a filter field in the top to filter a specific model out of the list

## Feat: support group selection tool

Expand Down
188 changes: 100 additions & 88 deletions src/assets/sass/fabric-icons-inline.scss

Large diffs are not rendered by default.

24 changes: 19 additions & 5 deletions src/common/localization/en-us.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export const english: IAppStrings = {
unknownTagName: "Unknown",
notCompatibleTagType: "Tag type is not compatible with this feature. If you want to change type of this tag, please remove or reassign all labels which using this tag in your project.",
checkboxPerTagLimit: "Cannot assign more than one checkbox per tag",
notCompatibleWithDrawnRegionTag: "drawnRegion and ${otherCatagory} values cannot both be assigned to the same document's tag",
},
toolbar: {
add: "Add new tag",
Expand Down Expand Up @@ -409,10 +410,12 @@ export const english: IAppStrings = {
subMenuItems: {
text: "Text",
tables: "Tables",
selectionMarks: "Selection Marks (Preview)",
selectionMarks: "Selection marks (preview)",
drawnRegions: "Drawn regions (preview)",
labels: "Labels"
},
}
},
drawRegion: "Draw region",
},
farItems: {
zoom: {
Expand Down Expand Up @@ -483,18 +486,29 @@ export const english: IAppStrings = {
backSpace: "Remove selection and delete labels of selected words",
},
},
drawnRegions: {
keys: {
escape: "Escape",
alt: "Alt",
backSpace: "Backspace",
},
description: {
deleteSelectedDrawnRegions: "Delete selected drawn regions",
cancelDrawOrReshape: "Cancel drawing or reshaping of regions",
}
},
tips: {
quickLabeling: {
name: "Quick labeling",
name: "Lable with hot keys",
description: "Hotkeys 1 through 0 and all letters are assigned to first 36 tags. After selecting one or multiple words, press tag's assigned hotkey.",
},
renameTag: {
name: "Rename tag",
description: "Hold Alt key and click on tag name.",
},
multipleWordSelection: {
name: "Select multiple words",
description: "Click and hold on word. Then, hover over additional words.",
name: "Select multiple words by dragging pointer across words",
description: "Click and hold on a word. Then, hover over additional words with pointer.",
},
deleteAllLabelsForTag: {
name: "Delete all labels for a tag",
Expand Down
20 changes: 17 additions & 3 deletions src/common/localization/es-cl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ export const spanish: IAppStrings = {
unknownTagName: "Desconocido",
notCompatibleTagType: "El tipo de etiqueta no es compatible con esta función. Si desea cambiar el tipo de esta etiqueta, elimine o reasigne todas las etiquetas que utilizan esta etiqueta en su proyecto.",
checkboxPerTagLimit: "No se puede asignar más de una casilla de verificación por etiqueta",
notCompatibleWithDrawnRegionTag: "Los valores de drawnRegion y $ {otherCatagory} no pueden asignarse a la misma etiqueta del documento",
},
toolbar: {
add: "Agregar nueva etiqueta",
Expand Down Expand Up @@ -412,9 +413,11 @@ export const spanish: IAppStrings = {
text: "Texto",
tables: "Tablas",
selectionMarks: "Marcas de selección (vista previa)",
drawnRegions: "Regiones dibujadas (vista previa)",
labels: "Etiquetas"
},
}
},
drawRegion: "Dibujar regiones",
},
farItems: {
zoom: {
Expand Down Expand Up @@ -485,6 +488,17 @@ export const spanish: IAppStrings = {
backSpace: "Eliminar selección del mapa del documento o clave de selección de una etiqueta",
},
},
drawnRegions: {
keys: {
escape: "Escape",
alt: "Alt",
backSpace: "Backspace",
},
description: {
deleteSelectedDrawnRegions: "Eliminar regiones dibujadas seleccionadas",
cancelDrawOrReshape: "Cancelar la modificación o remodelación de regiones",
}
},
tips: {
quickLabeling: {
name: "Etiquetado rápido",
Expand All @@ -495,8 +509,8 @@ export const spanish: IAppStrings = {
description: "Mantenga presionada la tecla Alt y haga clic en el nombre de la etiqueta, el usuario puede cambiar el nombre de la etiqueta.",
},
multipleWordSelection: {
name: "Selección de palabras múltiples",
description: "Haga clic y mantenga presionada la palabra, luego desplace el cursor sobre otras palabras para seleccionar varias palabras a la vez.",
name: "Seleccione varias palabras pasando el cursor con el puntero",
description: "Haga clic y mantenga presionada una palabra. Luego, coloca el cursor sobre palabras adicionales con el puntero.",
},
deleteAllLabelsForTag: {
name: "Eliminar información asociada a una etiqueta",
Expand Down
Loading

0 comments on commit dd78ed0

Please sign in to comment.