Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed automatic zooming in attribute annotation mode for masks #8657

Merged
merged 4 commits into from
Nov 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixed automatic zooming in attribute annotation mode for masks
bsekachev committed Nov 7, 2024
commit 0eac14d21d8339f952d9aa9133c70dbb080dbf67
4 changes: 4 additions & 0 deletions changelog.d/20241107_125333_sekachev.bs_fixed_aam_zoom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Fixed

- Fixed automatic zooming in attribute annotation mode for masks
(<https://github.com/cvat-ai/cvat/pull/XXXX>)
27 changes: 19 additions & 8 deletions cvat-canvas/src/typescript/canvasView.ts
Original file line number Diff line number Diff line change
@@ -1918,15 +1918,26 @@ export class CanvasViewImpl implements CanvasView, Listener {
this.gridPattern.setAttribute('height', `${size.height}`);
} else if (reason === UpdateReasons.SHAPE_FOCUSED) {
const { padding, clientID } = this.controller.focusData;
const drawnState = this.drawnStates[clientID];
const object = this.svgShapes[clientID];
if (object) {
const bbox: SVG.BBox = object.bbox();
this.onFocusRegion(
bbox.x - padding,
bbox.y - padding,
bbox.width + padding * 2,
bbox.height + padding * 2,
);
if (drawnState && object) {
const { offset } = this.geometry;
let [x, y, width, height] = [0, 0, 0, 0];

if (drawnState.shapeType === 'mask') {
const [xtl, ytl, xbr, ybr] = drawnState.points.slice(-4);
x = xtl + offset;
y = ytl + offset;
width = xbr - xtl;
height = ybr - ytl;
} else {
const bbox: SVG.BBox = object.bbox();
({
x, y, width, height,
} = bbox);
}

this.onFocusRegion(x - padding, y - padding, width + padding * 2, height + padding * 2);
}
} else if (reason === UpdateReasons.SHAPE_ACTIVATED) {
this.activate(this.controller.activeElement);

Unchanged files with check annotations Beta

point.fill({ opacity: this.isHidden ? 0 : 1 });
}
private updateHidden(value: boolean) {

Check warning on line 1311 in cvat-canvas/src/typescript/drawHandler.ts

GitHub Actions / Linter

Missing return type on function
this.isHidden = value;
if (value) {
return imageData;
}
private updateHidden(value: boolean) {

Check warning on line 229 in cvat-canvas/src/typescript/masksHandler.ts

GitHub Actions / Linter

Missing return type on function
this.isHidden = value;
// Need to update style of upper canvas explicitly because update of default cursor is not applied immediately
}
export default class PluginRegistry {
static async apiWrapper(wrappedFunc, ...args) {

Check warning on line 16 in cvat-core/src/plugins.ts

GitHub Actions / Linter

Missing return type on function
const pluginList = await PluginRegistry.list();
const aggregatedOptions: APIWrapperEnterOptions = {
preventMethodCall: false,
}
// Called with cvat context
static async register(plug) {

Check warning on line 57 in cvat-core/src/plugins.ts

GitHub Actions / Linter

Missing return type on function
const functions = [];
if (typeof plug !== 'object') {
throw new ArgumentError('Plugin must not contain a "functions" field');
}
function traverse(plugin, api) {

Check warning on line 76 in cvat-core/src/plugins.ts

GitHub Actions / Linter

Missing return type on function
const decorator = {};
for (const key in plugin) {
if (Object.prototype.hasOwnProperty.call(plugin, key)) {
plugins.push(plug);
}
static async list() {

Check warning on line 110 in cvat-core/src/plugins.ts

GitHub Actions / Linter

Missing return type on function
return plugins;
}
}
return new ServerError(message, 0);
}
function prepareData(details) {

Check warning on line 247 in cvat-core/src/server-proxy.ts

GitHub Actions / Linter

Missing return type on function
const data = new FormData();
for (const [key, value] of Object.entries(details)) {
if (Array.isArray(value)) {
return requestId++;
}
async function get(url: string, requestConfig) {

Check warning on line 289 in cvat-core/src/server-proxy.ts

GitHub Actions / Linter

Missing return type on function
return new Promise((resolve, reject) => {
const newRequestId = getRequestId();
requests[newRequestId] = { resolve, reject };
save_images: saveImages,
};
return new Promise<string | void>((resolve, reject) => {
async function request() {

Check warning on line 822 in cvat-core/src/server-proxy.ts

GitHub Actions / Linter

Missing return type on function
Axios.post(baseURL, {}, {
params,
})
const url = `${backendAPI}/tasks/${id}/backup/export`;
return new Promise<string | void>((resolve, reject) => {
async function request() {

Check warning on line 917 in cvat-core/src/server-proxy.ts

GitHub Actions / Linter

Missing return type on function
try {
const response = await Axios.post(url, {}, {
params,