mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-17 22:40:54 +02:00
Compare commits
3 Commits
dwelle/red
...
dwelle/col
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2cb1fa5e14 | ||
![]() |
a4e5e46dd1 | ||
![]() |
0fa5f5de4c |
@@ -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");
|
||||
}
|
||||
|
@@ -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);
|
||||
});
|
||||
|
||||
|
@@ -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) {
|
||||
|
@@ -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",
|
||||
|
BIN
public/Assistant-Regular.woff2
Normal file
BIN
public/Assistant-Regular.woff2
Normal file
Binary file not shown.
BIN
public/Cascadia.woff2
Normal file
BIN
public/Cascadia.woff2
Normal file
Binary file not shown.
BIN
public/Virgil.woff2
Normal file
BIN
public/Virgil.woff2
Normal file
Binary file not shown.
12
vercel.json
12
vercel.json
@@ -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": [
|
||||
|
Reference in New Issue
Block a user