Skip to content

Commit

Permalink
2463 extending selection not fully working (#2493)
Browse files Browse the repository at this point in the history
* Add IResponseUsedInDocument

* Add anchorText to response detail

* Change document model

* Add statsGet api route

* Add few comments

* update #2351, usedInDocuments + test

* introduce system settings

* add owner setting key + settings api router

* add api call for GET /settings/:key

* remove owner setting, add user role owner instead

* add endpoint / permission for getting owner user (Email)

* add api call to client's lib for getting owner data

* add request for getting first ever created audit + test + client api call

* add END key support in annotator, close #2321

* fix ENTER input, close #2320

* add api call for removing selected anchors from document + test

* Update IResponseUsedInDocument

* Improve documentation

* update implementation for IResponseUsedInDocument

* add Document's anchors tree structure, add test, finalize IResponseUsedInDocument

* Do not show entity tag if the provided entity is undefined

* Refactor warnings

* add PropSpecKind enum for Entity.extractIdsFromProps

* add TBasedWarnings to entity detail's warnings

* add parentT / resourceId from IResponseUsedInDocument to entities map

* Add section to the warning

* Add dummy api call to remove anchor

* 2065 list of anchors in entity detail open text in annotator from anchor list in one click anchor removal in detail (#2430)

* prepare anchor table

* implement the visual part of used in documents table

* remove mutation

* improvements

* abbreviate text, btn style

* hide delete btn

* prepare anchor btn, implement copy to clipboard

* open document modal from anchor

* scroll to anchor from used in documents

* refactor btn group props

* working solution

* 2416 add owner role to the user list table (#2452)

* sort users in user list

* sort, change icons, add tooltip

* conditions for owner role btns

* user icon to the navbar

* color rows

* remove owner from btn group in manage users, add owner to user import

* 2361 design and create the first owner modal (#2455)

* add modal and first attrs

* add validations to modal

* tidy up styles

* move validation rule to advanced components

* validations section header

* fns for add, edit, remove rules

* warning validation dict, add sections to modal

* validation settings to local state

* implement disabled settings

* better labels and descriptions to dict

* separate settings row to component

* tooltips

* capitalize descriptions

* owner only, hide settings

* better updating

* owner rights to menu

* add updateSettings api call

* Create group setting GET endpoint

* default import global validation settings

* fix groupSettings router

* update /settings/group/:group call

* 1989 switching off global | local validation rules in territory based validation rules (#2473)

* fetch settings preparation

* quick version with fetch

* fix empty validations

* log settings

* condition to disable submit btn

* add settingGroupUpdate to api

* add api handler for PUT settings/group/:groupid

* add acl permissions for put settings/group/:id

* add test for put settings/group/:id

* handle update

---------

Co-authored-by: Ján Mertel <10438157+jancimertel@users.noreply.github.com>

* Add ITerritoryValidationNode into response interface

* 2445 remove anchor from detail sectionc (#2490)

* add removeAnchor api call to api client

* implement removeAnchor api call on backend

* update entityIds in document after anchor removal

* start updating direction-based selecting in annotator

* fix dbl click + shift action after

* finalize refactoring text selections

---------

Co-authored-by: adammertel <12932677+adammertel@users.noreply.github.com>
Co-authored-by: Petr Hanak <petr.nahak@gmail.com>
  • Loading branch information
3 people authored Jan 12, 2025
1 parent b1d31af commit 5b1a1ad
Show file tree
Hide file tree
Showing 3 changed files with 165 additions and 145 deletions.
3 changes: 3 additions & 0 deletions packages/annotator/src/lib/Annotator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,9 @@ export class Annotator {
xLine: this.cursor.xLine + offsetRight,
yLine: this.cursor.yLine + this.viewport.lineStart,
};
this.cursor.xLine = this.cursor.selectEnd.xLine;
this.cursor.yLine = this.cursor.selectEnd.yLine;
this.cursor.selectDirection = DIRECTION.FORWARD
this.draw();
}

Expand Down
34 changes: 24 additions & 10 deletions packages/annotator/src/lib/Cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class Cursor
xLine: number;
yLine: number;

manualDirection?: DIRECTION;
selectDirection?: DIRECTION;

// highlighted area must use absolute coordinates - highlighted area stays in position while scrolling
private selecting: boolean = false;
Expand All @@ -35,32 +35,43 @@ export default class Cursor
this.style = { ...this.style, color: "black" };
}

getTrueSelectionDirection(): DIRECTION | null {
setTrueSelectionDirection() {
if (this.selectStart && this.selectEnd) {
if (this.selectStart.yLine < this.selectEnd.yLine) {
// start is above end
return DIRECTION.FORWARD;
this.selectDirection = DIRECTION.FORWARD;
console.log("setting forward");
return;
} else if (this.selectStart.yLine > this.selectEnd.yLine) {
// start is below end
return DIRECTION.BACKWARD;
this.selectDirection = DIRECTION.BACKWARD;
console.log("setting backward");
return;
} else {
// the same line
if (this.selectStart.xLine < this.selectEnd.xLine) {
// start is before end on horizontal axis
return DIRECTION.FORWARD;
this.selectDirection = DIRECTION.FORWARD;
console.log("setting forward");

return;
} else if (this.selectStart.xLine > this.selectEnd.xLine) {
// start is after end on horizontal axis
return DIRECTION.BACKWARD;
this.selectDirection = DIRECTION.BACKWARD;
console.log("setting backward");

return;
}
}
}

return null;
this.selectDirection = undefined;
console.log("setting undefined");
}

getSelectionDirection(): DIRECTION | undefined {
if (this.selectStart && this.selectEnd) {
return this.manualDirection;
return this.selectDirection;
}

return undefined;
Expand Down Expand Up @@ -147,6 +158,9 @@ export default class Cursor
} else {
this.selectEnd = { xLine: this.xLine, yLine: yOffset + this.yLine };
}

// test direction from selectArea call
this.setTrueSelectionDirection();
}

/**
Expand Down Expand Up @@ -276,7 +290,7 @@ export default class Cursor
getAbsolutePosition(viewport: Viewport): IAbsCoordinates {
return {
xLine: this.xLine,
yLine: this.yLine + viewport.lineStart
}
yLine: this.yLine + viewport.lineStart,
};
}
}
Loading

0 comments on commit 5b1a1ad

Please sign in to comment.