Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fb-lsdv-4864/noasync-magicwand-mig
Browse files Browse the repository at this point in the history
hlomzik authored Jan 31, 2024
2 parents d25814e + d2dce49 commit de5def0
Showing 19 changed files with 680 additions and 171 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/git-command.yml
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ jobs:
- uses: hmarr/debug-action@v2.1.0

- name: Add Workflow link to command comment
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
@@ -50,7 +50,7 @@ jobs:
echo "merge_conflict=$(git merge-tree $(git merge-base HEAD origin/$SLASH_COMMAND_ARG_BRANCH) origin/$SLASH_COMMAND_ARG_BRANCH HEAD | grep '<<')" >> $GITHUB_OUTPUT
- name: Add reaction to command comment on merge conflict
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
if: ${{ steps.check-conflict.outputs.merge_conflict }}
with:
token: ${{ secrets.GIT_PAT }}
@@ -81,7 +81,7 @@ jobs:
- name: Add reaction to command comment on nothing to do
if: ${{ !steps.check-conflict.outputs.merge_conflict && steps.commit_and_push.outputs.changes == 'no' }}
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
@@ -92,7 +92,7 @@ jobs:

- name: Add reaction to command comment on success
if: ${{ !steps.check-conflict.outputs.merge_conflict && steps.commit_and_push.outputs.changes == 'yes' }}
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
@@ -103,7 +103,7 @@ jobs:
reactions: "+1"

- name: Add reaction to command comment on failure
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
if: failure()
with:
token: ${{ secrets.GIT_PAT }}
@@ -119,7 +119,7 @@ jobs:
timeout-minutes: 1
steps:
- name: Update comment
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
2 changes: 1 addition & 1 deletion .github/workflows/help-command.yml
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ jobs:
steps:
- name: Update comment if empty
if: ${{ github.event.client_payload.slash_command.args.all == '' }}
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
8 changes: 4 additions & 4 deletions .github/workflows/jira-command.yml
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ jobs:
- uses: hmarr/debug-action@v2.1.0

- name: Add Workflow link to command comment
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
@@ -64,7 +64,7 @@ jobs:
type: ${{ github.event.client_payload.slash_command.args.unnamed.arg2 || 'task' }}

- name: Add reaction to command comment on success
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
@@ -74,7 +74,7 @@ jobs:
reactions: "+1"

- name: Add reaction to command comment on failure
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
if: failure()
with:
token: ${{ secrets.GIT_PAT }}
@@ -91,7 +91,7 @@ jobs:
timeout-minutes: 1
steps:
- name: Update comment
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GIT_PAT }}
repository: ${{ github.event.client_payload.github.payload.repository.full_name }}
2 changes: 1 addition & 1 deletion .github/workflows/slash-command-dispatch.yml
Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@ jobs:

- name: Edit comment with error message
if: ${{ steps.determine_command.outputs.command_state == 'unknown' }}
uses: peter-evans/create-or-update-comment@v3
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ github.event.comment.id }}
body: |
6 changes: 3 additions & 3 deletions .github/workflows/tests_coverage.yml
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ jobs:
name: unit-tests-coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3.1.4
uses: codecov/codecov-action@v3.1.5
if: ${{ !github.event.pull_request.head.repo.fork }}
with:
fail_ci_if_error: true
@@ -47,7 +47,7 @@ jobs:
name: e2e-tests-coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3.1.4
uses: codecov/codecov-action@v3.1.5
if: ${{ !github.event.pull_request.head.repo.fork }}
with:
fail_ci_if_error: true
@@ -69,7 +69,7 @@ jobs:
name: cypress-tests-coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3.1.4
uses: codecov/codecov-action@v3.1.5
if: ${{ !github.event.pull_request.head.repo.fork }}
with:
fail_ci_if_error: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -51,3 +51,6 @@ build/static/media/config.*.xml
# codecept screenshots
e2e/output
src/core/feature-flags/flags.json

# actions-hub
.github/actions-hub
41 changes: 30 additions & 11 deletions src/components/ImageView/ImageView.js
Original file line number Diff line number Diff line change
@@ -522,7 +522,9 @@ export default observer(
crosshairRef = createRef();
handleDeferredMouseDown = null;
deferredClickTimeout = [];
skipMouseUp = false;
skipNextMouseDown = false;
skipNextClick = false;
skipNextMouseUp = false;
mouseDownPoint = null;

constructor(props) {
@@ -536,10 +538,10 @@ export default observer(
const { item } = this.props;

if (isFF(FF_DEV_1442)) {
this.handleDeferredMouseDown?.();
this.handleDeferredMouseDown?.(true);
}
if (this.skipMouseUp) {
this.skipMouseUp = false;
if (this.skipNextClick) {
this.skipNextClick = false;
return;
}

@@ -572,8 +574,8 @@ export default observer(
};

handleDeferredClick = (handleDeferredMouseDownCallback, handleDeselection, eligibleToDeselect = false) => {
this.handleDeferredMouseDown = () => {
if (eligibleToDeselect) {
this.handleDeferredMouseDown = (wasClicked) => {
if (wasClicked && eligibleToDeselect) {
handleDeselection();
}
handleDeferredMouseDownCallback();
@@ -582,7 +584,7 @@ export default observer(
};
this.resetDeferredClickTimeout();
this.deferredClickTimeout.push(setTimeout(() => {
this.handleDeferredMouseDown?.();
this.handleDeferredMouseDown?.(false);
}, this.props.item.annotation.isDrawing ? 0 : 100));
};

@@ -591,6 +593,7 @@ export default observer(
const isPanTool = item.getToolsManager().findSelectedTool()?.fullName === 'ZoomPanTool';
const isMoveTool = item.getToolsManager().findSelectedTool()?.fullName === 'MoveTool';

this.skipNextMouseDown = this.skipNextMouseUp = this.skipNextClick = false;
if (isFF(FF_LSDV_4930)) {
this.mouseDownPoint = { x: e.evt.offsetX, y: e.evt.offsetY };
}
@@ -642,6 +645,10 @@ export default observer(

this.canvasX = left;
this.canvasY = top;
if (this.skipNextMouseDown) {
this.skipNextMouseDown = false;
return true;
}
item.event('mousedown', e, x, y);

return true;
@@ -668,7 +675,9 @@ export default observer(

const handleDeselection = () => {
item.annotation.unselectAll();
this.skipMouseUp = true;
this.skipNextMouseDown = true;
this.skipNextMouseUp = true;
this.skipNextClick = true;
};

this.handleDeferredClick(handleMouseDown, handleDeselection, eligibleToDeselect);
@@ -696,7 +705,7 @@ export default observer(

item.freezeHistory();

return item.event('mouseup', e, x - this.canvasX, y - this.canvasY);
return this.triggerMouseUp(e, x - this.canvasX, y - this.canvasY);
};

handleGlobalMouseMove = e => {
@@ -721,7 +730,17 @@ export default observer(
item.freezeHistory();
item.setSkipInteractions(false);

return item.event('mouseup', e, e.evt.offsetX, e.evt.offsetY);
return this.triggerMouseUp(e, e.evt.offsetX, e.evt.offsetY);
};

triggerMouseUp = (e, x, y) => {
if (this.skipNextMouseUp) {
this.skipNextMouseUp = false;
return;
}
const { item } = this.props;

return item.event('mouseup', e, x, y);
};

handleMouseMove = e => {
@@ -737,7 +756,7 @@ export default observer(

if (isFF(FF_DEV_1442) && isDragging) {
this.resetDeferredClickTimeout();
this.handleDeferredMouseDown?.();
this.handleDeferredMouseDown?.(false);
}

if ((isMouseWheelClick || isShiftDrag) && item.zoomScale > 1) {
29 changes: 29 additions & 0 deletions src/mixins/PerItem.js
Original file line number Diff line number Diff line change
@@ -22,6 +22,35 @@ const PerItemMixin = types
},
}))
.actions(self => ({
/**
* Validates all values related to the current classification per item (Multi Items Segmentation).
*
* - This method should not be overridden.
* - It is used only in validate method of the ClassificationBase mixin.
*
* @returns {boolean}
* @private
*/
_validatePerItem() {
const objectTag = self.toNameTag;

return self.annotation.regions
.every((reg) => {
const result = reg.results.find(s => s.from_name === self);

if (!result?.hasValue) {
return true;
}
const value = result.mainValue;
const isValid = self.validateValue(value);

if (!isValid) {
objectTag.setCurrentItem(reg.item_index);
return false;
}
return true;
});
},
createPerItemResult() {
self.createPerObjectResult({
item_index: self.toNameTag.currentItemIndex,
24 changes: 24 additions & 0 deletions src/mixins/PerRegion.js
Original file line number Diff line number Diff line change
@@ -55,6 +55,30 @@ const PerRegionMixin = types
},
}))
.actions(self => ({
/**
* Validates all values related to the current classification per region.
*
* - This method should not be overridden.
* - It is used only in validate method of the ClassificationBase mixin.
*
* @returns {boolean}
* @private
*/
_validatePerRegion() {
const objectTag = self.toNameTag;

for (const reg of objectTag.allRegs) {
const value = reg.results.find(s => s.from_name === self)?.mainValue;
const isValid = self.validateValue(value);

if (!isValid) {
self.annotation.selectArea(reg);
return false;
}
}

return true;
},
createPerRegionResult() {
self.perRegionArea?.setValue(self);
},
Loading

0 comments on commit de5def0

Please sign in to comment.