Skip to content

Commit

Permalink
refactor(whiteboard): change to selector once insert image (#1629)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrious authored Aug 5, 2022
1 parent a2d3878 commit c199564
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions desktop/renderer-app/src/stores/whiteboard-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { makeAutoObservable, observable, runInAction } from "mobx";
import { isMobile, isWindows } from "react-device-detect";
import {
AnimationMode,
ApplianceNames,
DeviceType,
Room,
RoomPhase,
Expand Down Expand Up @@ -555,6 +556,8 @@ export class WhiteboardStore {
// width: width,
// height: height,
// });

windowManager.mainView.setMemberState({ currentApplianceName: ApplianceNames.selector });
};

public insertMediaFile = async (file: CloudStorageFile): Promise<void> => {
Expand Down
3 changes: 2 additions & 1 deletion desktop/renderer-app/src/utils/drag-and-drop/image.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { message } from "antd";
import { v4 as v4uuid } from "uuid";
import type { Room, Size } from "white-web-sdk";
import { ApplianceNames, Room, Size } from "white-web-sdk";
import { listFiles } from "../../api-middleware/flatServer/storage";
import { i18n } from "../i18n";
import { UploadTask } from "../upload-task-manager/upload-task";
Expand Down Expand Up @@ -50,6 +50,7 @@ export async function onDropImage(file: File, x: number, y: number, room: Room):
const { width, height } = await getSize;
room.insertImage({ uuid, centerX: x, centerY: y, width, height, locked: false });
room.completeImageUpload(uuid, cloudFile.fileURL);
room.setMemberState({ currentApplianceName: ApplianceNames.selector });
}

export function getImageSize(file: File): Promise<Size> {
Expand Down
3 changes: 3 additions & 0 deletions web/flat-web/src/stores/whiteboard-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { isMobile, isWindows } from "react-device-detect";
import { v4 as v4uuid } from "uuid";
import {
AnimationMode,
ApplianceNames,
DeviceType,
Room,
RoomPhase,
Expand Down Expand Up @@ -524,6 +525,8 @@ export class WhiteboardStore {
// width: width,
// height: height,
// });

windowManager.mainView.setMemberState({ currentApplianceName: ApplianceNames.selector });
};

public insertMediaFile = async (file: CloudStorageFile): Promise<void> => {
Expand Down
3 changes: 2 additions & 1 deletion web/flat-web/src/utils/drag-and-drop/image.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { message } from "antd";
import { v4 as v4uuid } from "uuid";
import type { Room, Size } from "white-web-sdk";
import { ApplianceNames, Room, Size } from "white-web-sdk";
import { listFiles } from "../../api-middleware/flatServer/storage";
import { i18n } from "../i18n";
import { UploadTask } from "../upload-task-manager/upload-task";
Expand Down Expand Up @@ -50,6 +50,7 @@ export async function onDropImage(file: File, x: number, y: number, room: Room):
const { width, height } = await getSize;
room.insertImage({ uuid, centerX: x, centerY: y, width, height, locked: false });
room.completeImageUpload(uuid, cloudFile.fileURL);
room.setMemberState({ currentApplianceName: ApplianceNames.selector });
}

export function getImageSize(file: File): Promise<Size> {
Expand Down

0 comments on commit c199564

Please sign in to comment.