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

feat(drawing): add optional param to contrl popup #3935

Merged
merged 6 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion packages/drawing/src/services/drawing-manager.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/

import type { BooleanNumber, IDisposable, Nullable } from '@univerjs/core';
import { createIdentifier } from '@univerjs/core';
import type { Observable } from 'rxjs';
import type { ITransformState } from './interface';
import { createIdentifier } from '@univerjs/core';

export const DEFAULT_DOCUMENT_SUB_COMPONENT_ID = '__default_document_sub_component_id20231101__';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@

import type { IDisposable, Nullable, Workbook } from '@univerjs/core';
import type { BaseObject, Scene } from '@univerjs/engine-render';
import type { ISheetFloatDom } from '@univerjs/sheets-drawing';
import { connectInjector, FOCUSING_COMMON_DRAWINGS, IContextService, Inject, Injector, IUniverInstanceService, RxDisposable, toDisposable, UniverInstanceType } from '@univerjs/core';
import { DrawingTypeEnum, IDrawingManagerService } from '@univerjs/drawing';
import { COMPONENT_IMAGE_POPUP_MENU, ImageCropperObject, ImageResetSizeOperation, OpenImageCropOperation } from '@univerjs/drawing-ui';
import { IRenderManagerService } from '@univerjs/engine-render';
import { SheetCanvasPopManagerService } from '@univerjs/sheets-ui';
import { BuiltInUIPart, IUIPartsService } from '@univerjs/ui';
import { takeUntil } from 'rxjs';

import { takeUntil } from 'rxjs';
import { RemoveSheetDrawingCommand } from '../commands/commands/remove-sheet-drawing.command';
import { EditSheetDrawingOperation } from '../commands/operations/edit-sheet-drawing.operation';
import { UploadLoading } from '../views/upload-loading/UploadLoading';
Expand Down Expand Up @@ -119,6 +120,12 @@ export class DrawingPopupMenuController extends RxDisposable {
}

const { unitId, subUnitId, drawingId, drawingType } = drawingParam;
// drawingParam should be ICanvasFloatDom, use for disable popup dialog
const data = (drawingParam as ISheetFloatDom).data as Record<string, boolean>;
if (data && data.disablePopup) {
return;
}

singletonPopupDisposer?.dispose();
singletonPopupDisposer = this.disposeWithMe(this._canvasPopManagerService.attachPopupToObject(object, {
componentKey: COMPONENT_IMAGE_POPUP_MENU,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,13 @@ export class SheetCanvasFloatDomManagerService extends Disposable {
const target = getSheetCommandTarget(this._univerInstanceService, { unitId, subUnitId });
const floatDomParam = this._drawingManagerService.getDrawingByParam(param) as IFloatDomData;

const workbook = this._univerInstanceService.getUnit<Workbook>(unitId)!;
if (!workbook) {
return;
}

const activeSheetId = workbook.getActiveSheet().getSheetId();

if (!floatDomParam || !target) {
return;
}
Expand All @@ -301,6 +308,10 @@ export class SheetCanvasFloatDomManagerService extends Disposable {
return true;
}

if (activeSheetId !== subUnitId) {
return;
}

const { left, top, width, height, angle, flipX, flipY, skewX, skewY } = transform;

const rectShapeKey = getDrawingShapeKeyByDrawingSearch({ unitId, subUnitId, drawingId });
Expand Down
Loading