Compare commits

..

3 Commits

Author SHA1 Message Date
dwelle
2cb1fa5e14 wip 2024-01-16 17:43:14 +01:00
Aakansha Doshi
a4e5e46dd1 fix: move default to last so its compatible with nextjs (#7561) 2024-01-15 14:52:04 +05:30
David Luzar
0fa5f5de4c fix: translating frames containing grouped text containers (#7557) 2024-01-13 21:28:54 +01:00
8 changed files with 23 additions and 36 deletions

View File

@@ -442,6 +442,7 @@ class Collab extends PureComponent<Props, CollabState> {
);
const fallbackInitializationHandler = () => {
console.log("fallbackInitializationHandler");
this.initializeRoom({
roomLinkData: existingRoomLinkData,
fetchScene: true,
@@ -516,7 +517,9 @@ class Collab extends PureComponent<Props, CollabState> {
case WS_SUBTYPES.INVALID_RESPONSE:
return;
case WS_SUBTYPES.INIT: {
console.log("INIT (1)");
if (!this.portal.socketInitialized) {
console.log("INIT (2)");
this.initializeRoom({ fetchScene: false });
const remoteElements = decryptedData.payload.elements;
const reconciledElements = this.reconcileElements(remoteElements);
@@ -606,6 +609,7 @@ class Collab extends PureComponent<Props, CollabState> {
);
this.portal.socket.on("first-in-room", async () => {
console.log("first-in-room");
if (this.portal.socket) {
this.portal.socket.off("first-in-room");
}

View File

@@ -38,9 +38,17 @@ class Portal {
this.roomId = id;
this.roomKey = key;
this.socket.on("connect", () => {
console.log("connect");
});
console.log("subbing to init-room");
// Initialize socket listeners
this.socket.on("init-room", () => {
console.log("init-room (1)");
if (this.socket) {
console.log("init-room (2)");
this.socket.emit("join-room", this.roomId);
trackEvent("share", "room joined");
}
@@ -53,6 +61,7 @@ class Portal {
);
});
this.socket.on("room-user-change", (clients: SocketId[]) => {
console.log("room-user-change", clients);
this.collab.setCollaborators(clients);
});

View File

@@ -5,14 +5,9 @@ import { getPerfectElementSize } from "./sizeHelpers";
import { NonDeletedExcalidrawElement } from "./types";
import { AppState, PointerDownState } from "../types";
import { getBoundTextElement } from "./textElement";
import { isSelectedViaGroup } from "../groups";
import { getGridPoint } from "../math";
import Scene from "../scene/Scene";
import {
isArrowElement,
isBoundToContainer,
isFrameLikeElement,
} from "./typeChecks";
import { isArrowElement, isFrameLikeElement } from "./typeChecks";
export const dragSelectedElements = (
pointerDownState: PointerDownState,
@@ -37,13 +32,11 @@ export const dragSelectedElements = (
.map((f) => f.id);
if (frames.length > 0) {
const elementsInFrames = scene
.getNonDeletedElements()
.filter((e) => !isBoundToContainer(e))
.filter((e) => e.frameId !== null)
.filter((e) => frames.includes(e.frameId!));
elementsInFrames.forEach((element) => elementsToUpdate.add(element));
for (const element of scene.getNonDeletedElements()) {
if (element.frameId !== null && frames.includes(element.frameId)) {
elementsToUpdate.add(element);
}
}
}
const commonBounds = getCommonBounds(
@@ -60,16 +53,9 @@ export const dragSelectedElements = (
elementsToUpdate.forEach((element) => {
updateElementCoords(pointerDownState, element, adjustedOffset);
// update coords of bound text only if we're dragging the container directly
// (we don't drag the group that it's part of)
if (
// Don't update coords of arrow label since we calculate its position during render
!isArrowElement(element) &&
// container isn't part of any group
// (perf optim so we don't check `isSelectedViaGroup()` in every case)
(!element.groupIds.length ||
// container is part of a group, but we're dragging the container directly
(appState.editingGroupId && !isSelectedViaGroup(appState, element)))
// skip arrow labels since we calculate its position during render
!isArrowElement(element)
) {
const textElement = getBoundTextElement(element);
if (textElement) {

View File

@@ -7,8 +7,8 @@
"exports": {
".": {
"development": "./dist/dev/index.js",
"default": "./dist/prod/index.js",
"types": "./dist/excalidraw/index.d.ts"
"types": "./dist/excalidraw/index.d.ts",
"default": "./dist/prod/index.js"
},
"./index.css": {
"development": "./dist/dev/index.css",

Binary file not shown.

BIN
public/Cascadia.woff2 Normal file

Binary file not shown.

BIN
public/Virgil.woff2 Normal file

Binary file not shown.

View File

@@ -28,18 +28,6 @@
"source": "/webex/:match*",
"destination": "https://for-webex.excalidraw.com"
},
{
"source": "/Virgil.woff2",
"destination": "https://excalidraw.nyc3.cdn.digitaloceanspaces.com/fonts/Virgil.woff2"
},
{
"source": "/Cascadia.woff2",
"destination": "https://excalidraw.nyc3.cdn.digitaloceanspaces.com/fonts/Cascadia.woff2"
},
{
"source": "/Assistant-Regular.woff2",
"destination": "https://excalidraw.nyc3.cdn.digitaloceanspaces.com/fonts/Assistant-Regular.woff2"
},
{
"source": "/:path*",
"has": [