docstring_tokens
stringlengths 18
16.9k
| code_tokens
stringlengths 75
1.81M
| html_url
stringlengths 74
116
| file_name
stringlengths 3
311
|
---|---|---|---|
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
|
<mask> pointerY,
<mask> );
<mask> updateBoundElements(element);
<mask> } else if (transformHandleType) {
<mask> if (isGenericElement(element)) {
<mask> resizeSingleGenericElement(
<mask> pointerDownState.originalElements.get(element.id) as typeof element,
<mask> shouldKeepSidesRatio,
<mask> element,
<mask> transformHandleType,
<mask> isResizeCenterPoint,
<mask> pointerX,
<mask> pointerY,
<mask> );
<mask> } else {
<mask> const keepSquareAspectRatio = shouldKeepSidesRatio;
<mask> resizeSingleNonGenericElement(
<mask> element,
<mask> transformHandleType,
<mask> isResizeCenterPoint,
<mask> keepSquareAspectRatio,
<mask> pointerX,
<mask> pointerY,
<mask> );
<mask> setTransformHandle(
<mask> normalizeTransformHandleType(element, transformHandleType),
<mask> );
<mask> if (element.width < 0) {
<mask> mutateElement(element, { width: -element.width });
<mask> }
<mask> if (element.height < 0) {
<mask> mutateElement(element, { height: -element.height });
<mask> }
<mask> }
<mask> }
<mask>
<mask> // update cursor
<mask> // FIXME it is not very nice to have this here
<mask> document.documentElement.style.cursor = getCursorForResizingElement({
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove
export const normalizeTransformHandleType = (
element: ExcalidrawElement,
transformHandleType: TransformHandleType,
): TransformHandleType => {
if (element.width >= 0 && element.height >= 0) {
return transformHandleType;
}
if (element.width < 0 && element.height < 0) {
switch (transformHandleType) {
case "nw":
return "se";
case "ne":
return "sw";
case "se":
return "nw";
case "sw":
return "ne";
}
} else if (element.width < 0) {
switch (transformHandleType) {
case "nw":
return "ne";
case "ne":
return "nw";
case "se":
return "sw";
case "sw":
return "se";
case "e":
return "w";
case "w":
return "e";
}
} else {
switch (transformHandleType) {
case "nw":
return "sw";
case "ne":
return "se";
case "se":
return "ne";
case "sw":
return "nw";
case "n":
return "s";
case "s":
return "n";
}
}
return transformHandleType;
};
</s> add </s> remove if (newWidth < 0) {
</s> add if (eleNewWidth < 0) { </s> remove if (newHeight < 0) {
</s> add if (eleNewHeight < 0) { </s> remove let scaleX = 1;
let scaleY = 1;
if (
transformHandleType === "e" ||
transformHandleType === "ne" ||
transformHandleType === "se"
) {
scaleX = (rotatedX - x1) / (x2 - x1);
}
if (
transformHandleType === "s" ||
transformHandleType === "sw" ||
transformHandleType === "se"
) {
scaleY = (rotatedY - y1) / (y2 - y1);
}
if (
transformHandleType === "w" ||
transformHandleType === "nw" ||
transformHandleType === "sw"
) {
scaleX = (x2 - rotatedX) / (x2 - x1);
}
if (
transformHandleType === "n" ||
transformHandleType === "nw" ||
transformHandleType === "ne"
) {
scaleY = (y2 - rotatedY) / (y2 - y1);
}
let nextWidth = element.width * scaleX;
let nextHeight = element.height * scaleY;
if (keepSquareAspectRatio) {
nextWidth = nextHeight = Math.max(nextWidth, nextHeight);
}
const [nextX1, nextY1, nextX2, nextY2] = getResizedElementAbsoluteCoords(
element,
nextWidth,
nextHeight,
);
const deltaX1 = (x1 - nextX1) / 2;
const deltaY1 = (y1 - nextY1) / 2;
const deltaX2 = (x2 - nextX2) / 2;
const deltaY2 = (y2 - nextY2) / 2;
const rescaledPoints = rescalePointsInElement(element, nextWidth, nextHeight);
updateBoundElements(element, {
newSize: { width: nextWidth, height: nextHeight },
});
const [finalX1, finalY1, finalX2, finalY2] = getResizedElementAbsoluteCoords(
{
...element,
...rescaledPoints,
},
Math.abs(nextWidth),
Math.abs(nextHeight),
);
const [flipDiffX, flipDiffY] = getFlipAdjustment(
transformHandleType,
nextWidth,
nextHeight,
nextX1,
nextY1,
nextX2,
nextY2,
finalX1,
finalY1,
finalX2,
finalY2,
isLinearElement(element),
element.angle,
);
const [nextElementX, nextElementY] = adjustXYWithRotation(
getSidesForTransformHandle(transformHandleType, isResizeFromCenter),
element.x - flipDiffX,
element.y - flipDiffY,
element.angle,
deltaX1,
deltaY1,
deltaX2,
deltaY2,
);
</s> add const resizedElement = {
width: Math.abs(eleNewWidth),
height: Math.abs(eleNewHeight),
x: newOrigin[0],
y: newOrigin[1],
...rescaledPoints,
}; </s> remove const resizedElement = {
width: Math.abs(newWidth),
height: Math.abs(newHeight),
x: newTopLeft[0],
y: newTopLeft[1],
};
updateBoundElements(element, {
newSize: { width: resizedElement.width, height: resizedElement.height },
});
mutateElement(element, resizedElement);
};
const resizeSingleNonGenericElement = (
element: NonDeleted<Exclude<ExcalidrawElement, ExcalidrawGenericElement>>,
transformHandleType: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
isResizeFromCenter: boolean,
keepSquareAspectRatio: boolean,
pointerX: number,
pointerY: number,
) => {
const [x1, y1, x2, y2] = getElementAbsoluteCoords(element);
const cx = (x1 + x2) / 2;
const cy = (y1 + y2) / 2;
// rotation pointer with reverse angle
const [rotatedX, rotatedY] = rotate(
pointerX,
pointerY,
cx,
cy,
-element.angle,
</s> add // Readjust points for linear elements
const rescaledPoints = rescalePointsInElement(
stateAtResizeStart,
eleNewWidth,
eleNewHeight, </s> remove export const getFlipAdjustment = (
side: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
nextWidth: number,
nextHeight: number,
nextX1: number,
nextY1: number,
nextX2: number,
nextY2: number,
finalX1: number,
finalY1: number,
finalX2: number,
finalY2: number,
needsRotation: boolean,
angle: number,
): [number, number] => {
const cos = Math.cos(angle);
const sin = Math.sin(angle);
let flipDiffX = 0;
let flipDiffY = 0;
if (nextWidth < 0) {
if (side === "e" || side === "ne" || side === "se") {
if (needsRotation) {
flipDiffX += (finalX2 - nextX1) * cos;
flipDiffY += (finalX2 - nextX1) * sin;
} else {
flipDiffX += finalX2 - nextX1;
}
}
if (side === "w" || side === "nw" || side === "sw") {
if (needsRotation) {
flipDiffX += (finalX1 - nextX2) * cos;
flipDiffY += (finalX1 - nextX2) * sin;
} else {
flipDiffX += finalX1 - nextX2;
}
}
}
if (nextHeight < 0) {
if (side === "s" || side === "se" || side === "sw") {
if (needsRotation) {
flipDiffY += (finalY2 - nextY1) * cos;
flipDiffX += (finalY2 - nextY1) * -sin;
} else {
flipDiffY += finalY2 - nextY1;
}
}
if (side === "n" || side === "ne" || side === "nw") {
if (needsRotation) {
flipDiffY += (finalY1 - nextY2) * cos;
flipDiffX += (finalY1 - nextY2) * -sin;
} else {
flipDiffY += finalY1 - nextY2;
}
}
}
return [flipDiffX, flipDiffY];
};
</s> add
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> });
<mask> }
<mask> };
<mask>
<mask> const resizeSingleGenericElement = (
<mask> stateAtResizeStart: NonDeleted<ExcalidrawGenericElement>,
<mask> shouldKeepSidesRatio: boolean,
<mask> element: NonDeletedExcalidrawElement,
<mask> transformHandleDirection: TransformHandleDirection,
<mask> isResizeFromCenter: boolean,
<mask> pointerX: number,
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove const resizedElement = {
width: Math.abs(newWidth),
height: Math.abs(newHeight),
x: newTopLeft[0],
y: newTopLeft[1],
};
updateBoundElements(element, {
newSize: { width: resizedElement.width, height: resizedElement.height },
});
mutateElement(element, resizedElement);
};
const resizeSingleNonGenericElement = (
element: NonDeleted<Exclude<ExcalidrawElement, ExcalidrawGenericElement>>,
transformHandleType: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
isResizeFromCenter: boolean,
keepSquareAspectRatio: boolean,
pointerX: number,
pointerY: number,
) => {
const [x1, y1, x2, y2] = getElementAbsoluteCoords(element);
const cx = (x1 + x2) / 2;
const cy = (y1 + y2) / 2;
// rotation pointer with reverse angle
const [rotatedX, rotatedY] = rotate(
pointerX,
pointerY,
cx,
cy,
-element.angle,
</s> add // Readjust points for linear elements
const rescaledPoints = rescalePointsInElement(
stateAtResizeStart,
eleNewWidth,
eleNewHeight, </s> remove const [x1, y1, x2, y2] = getElementAbsoluteCoords(stateAtResizeStart);
</s> add // Gets bounds corners
const [x1, y1, x2, y2] = getResizedElementAbsoluteCoords(
stateAtResizeStart,
stateAtResizeStart.width,
stateAtResizeStart.height,
); </s> remove setTransformHandle: (nextTransformHandle: MaybeTransformHandleType) => void,
</s> add </s> remove export const getFlipAdjustment = (
side: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
nextWidth: number,
nextHeight: number,
nextX1: number,
nextY1: number,
nextX2: number,
nextY2: number,
finalX1: number,
finalY1: number,
finalX2: number,
finalY2: number,
needsRotation: boolean,
angle: number,
): [number, number] => {
const cos = Math.cos(angle);
const sin = Math.sin(angle);
let flipDiffX = 0;
let flipDiffY = 0;
if (nextWidth < 0) {
if (side === "e" || side === "ne" || side === "se") {
if (needsRotation) {
flipDiffX += (finalX2 - nextX1) * cos;
flipDiffY += (finalX2 - nextX1) * sin;
} else {
flipDiffX += finalX2 - nextX1;
}
}
if (side === "w" || side === "nw" || side === "sw") {
if (needsRotation) {
flipDiffX += (finalX1 - nextX2) * cos;
flipDiffY += (finalX1 - nextX2) * sin;
} else {
flipDiffX += finalX1 - nextX2;
}
}
}
if (nextHeight < 0) {
if (side === "s" || side === "se" || side === "sw") {
if (needsRotation) {
flipDiffY += (finalY2 - nextY1) * cos;
flipDiffX += (finalY2 - nextY1) * -sin;
} else {
flipDiffY += finalY2 - nextY1;
}
}
if (side === "n" || side === "ne" || side === "nw") {
if (needsRotation) {
flipDiffY += (finalY1 - nextY2) * cos;
flipDiffX += (finalY1 - nextY2) * -sin;
} else {
flipDiffY += finalY1 - nextY2;
}
}
}
return [flipDiffX, flipDiffY];
};
</s> add </s> add mutateElement(element, resizedElement); </s> remove mutateElement(element, {
width: nextWidth,
height: nextHeight,
x: nextElementX,
y: nextElementY,
...rescaledPoints,
</s> add updateBoundElements(element, {
newSize: { width: resizedElement.width, height: resizedElement.height },
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> isResizeFromCenter: boolean,
<mask> pointerX: number,
<mask> pointerY: number,
<mask> ) => {
<mask> const [x1, y1, x2, y2] = getElementAbsoluteCoords(stateAtResizeStart);
<mask> const startTopLeft: Point = [x1, y1];
<mask> const startBottomRight: Point = [x2, y2];
<mask> const startCenter: Point = centerPoint(startTopLeft, startBottomRight);
<mask>
<mask> // Calculate new dimensions based on cursor position
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove let newWidth = stateAtResizeStart.width;
let newHeight = stateAtResizeStart.height;
</s> add </s> remove const resizedElement = {
width: Math.abs(newWidth),
height: Math.abs(newHeight),
x: newTopLeft[0],
y: newTopLeft[1],
};
updateBoundElements(element, {
newSize: { width: resizedElement.width, height: resizedElement.height },
});
mutateElement(element, resizedElement);
};
const resizeSingleNonGenericElement = (
element: NonDeleted<Exclude<ExcalidrawElement, ExcalidrawGenericElement>>,
transformHandleType: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
isResizeFromCenter: boolean,
keepSquareAspectRatio: boolean,
pointerX: number,
pointerY: number,
) => {
const [x1, y1, x2, y2] = getElementAbsoluteCoords(element);
const cx = (x1 + x2) / 2;
const cy = (y1 + y2) / 2;
// rotation pointer with reverse angle
const [rotatedX, rotatedY] = rotate(
pointerX,
pointerY,
cx,
cy,
-element.angle,
</s> add // Readjust points for linear elements
const rescaledPoints = rescalePointsInElement(
stateAtResizeStart,
eleNewWidth,
eleNewHeight, </s> remove const resizeSingleGenericElement = (
stateAtResizeStart: NonDeleted<ExcalidrawGenericElement>,
</s> add const resizeSingleElement = (
stateAtResizeStart: NonDeletedExcalidrawElement, </s> remove newTopLeft[0] + Math.abs(newWidth) / 2,
newTopLeft[1] + Math.abs(newHeight) / 2,
</s> add newTopLeft[0] + Math.abs(newBoundsWidth) / 2,
newTopLeft[1] + Math.abs(newBoundsHeight) / 2, </s> remove export const getFlipAdjustment = (
side: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
nextWidth: number,
nextHeight: number,
nextX1: number,
nextY1: number,
nextX2: number,
nextY2: number,
finalX1: number,
finalY1: number,
finalX2: number,
finalY2: number,
needsRotation: boolean,
angle: number,
): [number, number] => {
const cos = Math.cos(angle);
const sin = Math.sin(angle);
let flipDiffX = 0;
let flipDiffY = 0;
if (nextWidth < 0) {
if (side === "e" || side === "ne" || side === "se") {
if (needsRotation) {
flipDiffX += (finalX2 - nextX1) * cos;
flipDiffY += (finalX2 - nextX1) * sin;
} else {
flipDiffX += finalX2 - nextX1;
}
}
if (side === "w" || side === "nw" || side === "sw") {
if (needsRotation) {
flipDiffX += (finalX1 - nextX2) * cos;
flipDiffY += (finalX1 - nextX2) * sin;
} else {
flipDiffX += finalX1 - nextX2;
}
}
}
if (nextHeight < 0) {
if (side === "s" || side === "se" || side === "sw") {
if (needsRotation) {
flipDiffY += (finalY2 - nextY1) * cos;
flipDiffX += (finalY2 - nextY1) * -sin;
} else {
flipDiffY += finalY2 - nextY1;
}
}
if (side === "n" || side === "ne" || side === "nw") {
if (needsRotation) {
flipDiffY += (finalY1 - nextY2) * cos;
flipDiffX += (finalY1 - nextY2) * -sin;
} else {
flipDiffY += finalY1 - nextY2;
}
}
}
return [flipDiffX, flipDiffY];
};
</s> add </s> add const [
newBoundsX1,
newBoundsY1,
newBoundsX2,
newBoundsY2,
] = getResizedElementAbsoluteCoords(
stateAtResizeStart,
eleNewWidth,
eleNewHeight,
);
const newBoundsWidth = newBoundsX2 - newBoundsX1;
const newBoundsHeight = newBoundsY2 - newBoundsY1;
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> const startBottomRight: Point = [x2, y2];
<mask> const startCenter: Point = centerPoint(startTopLeft, startBottomRight);
<mask>
<mask> // Calculate new dimensions based on cursor position
<mask> let newWidth = stateAtResizeStart.width;
<mask> let newHeight = stateAtResizeStart.height;
<mask> const rotatedPointer = rotatePoint(
<mask> [pointerX, pointerY],
<mask> startCenter,
<mask> -stateAtResizeStart.angle,
<mask> );
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove const [x1, y1, x2, y2] = getElementAbsoluteCoords(stateAtResizeStart);
</s> add // Gets bounds corners
const [x1, y1, x2, y2] = getResizedElementAbsoluteCoords(
stateAtResizeStart,
stateAtResizeStart.width,
stateAtResizeStart.height,
); </s> add // Linear elements dimensions differ from bounds dimensions
const eleInitialWidth = stateAtResizeStart.width;
const eleInitialHeight = stateAtResizeStart.height;
// We have to use dimensions of element on screen, otherwise the scaling of the
// dimensions won't match the cursor for linear elements.
let eleNewWidth = element.width * scaleX;
let eleNewHeight = element.height * scaleY; </s> add //Get bounds corners rendered on screen
const [esx1, esy1, esx2, esy2] = getResizedElementAbsoluteCoords(
element,
element.width,
element.height,
);
const boundsCurrentWidth = esx2 - esx1;
const boundsCurrentHeight = esy2 - esy1;
// It's important we set the initial scale value based on the width and height at resize start,
// otherwise previous dimensions affected by modifiers will be taken into account.
const atStartBoundsWidth = startBottomRight[0] - startTopLeft[0];
const atStartBoundsHeight = startBottomRight[1] - startTopLeft[1];
let scaleX = atStartBoundsWidth / boundsCurrentWidth;
let scaleY = atStartBoundsHeight / boundsCurrentHeight;
</s> add const [
newBoundsX1,
newBoundsY1,
newBoundsX2,
newBoundsY2,
] = getResizedElementAbsoluteCoords(
stateAtResizeStart,
eleNewWidth,
eleNewHeight,
);
const newBoundsWidth = newBoundsX2 - newBoundsX1;
const newBoundsHeight = newBoundsY2 - newBoundsY1;
</s> remove newWidth = stateAtResizeStart.width * ratio * Math.sign(newWidth);
newHeight = stateAtResizeStart.height * ratio * Math.sign(newHeight);
</s> add eleNewWidth = eleInitialWidth * ratio * Math.sign(eleNewWidth);
eleNewHeight = eleInitialHeight * ratio * Math.sign(eleNewHeight); </s> remove newTopLeft[0] + Math.abs(newWidth) / 2,
newTopLeft[1] + Math.abs(newHeight) / 2,
</s> add newTopLeft[0] + Math.abs(newBoundsWidth) / 2,
newTopLeft[1] + Math.abs(newBoundsHeight) / 2,
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep keep add keep keep keep keep keep keep
|
<mask> startCenter,
<mask> -stateAtResizeStart.angle,
<mask> );
<mask> if (transformHandleDirection.includes("e")) {
<mask> scaleX = (rotatedPointer[0] - startTopLeft[0]) / boundsCurrentWidth;
<mask> }
<mask> if (transformHandleDirection.includes("s")) {
<mask> scaleY = (rotatedPointer[1] - startTopLeft[1]) / boundsCurrentHeight;
<mask> }
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove newWidth = rotatedPointer[0] - startTopLeft[0];
</s> add scaleX = (rotatedPointer[0] - startTopLeft[0]) / boundsCurrentWidth; </s> remove newHeight = rotatedPointer[1] - startTopLeft[1];
</s> add scaleY = (rotatedPointer[1] - startTopLeft[1]) / boundsCurrentHeight; </s> remove newWidth = startBottomRight[0] - rotatedPointer[0];
</s> add scaleX = (startBottomRight[0] - rotatedPointer[0]) / boundsCurrentWidth; </s> remove newHeight = startBottomRight[1] - rotatedPointer[1];
</s> add scaleY = (startBottomRight[1] - rotatedPointer[1]) / boundsCurrentHeight; </s> remove let scaleX = 1;
let scaleY = 1;
if (
transformHandleType === "e" ||
transformHandleType === "ne" ||
transformHandleType === "se"
) {
scaleX = (rotatedX - x1) / (x2 - x1);
}
if (
transformHandleType === "s" ||
transformHandleType === "sw" ||
transformHandleType === "se"
) {
scaleY = (rotatedY - y1) / (y2 - y1);
}
if (
transformHandleType === "w" ||
transformHandleType === "nw" ||
transformHandleType === "sw"
) {
scaleX = (x2 - rotatedX) / (x2 - x1);
}
if (
transformHandleType === "n" ||
transformHandleType === "nw" ||
transformHandleType === "ne"
) {
scaleY = (y2 - rotatedY) / (y2 - y1);
}
let nextWidth = element.width * scaleX;
let nextHeight = element.height * scaleY;
if (keepSquareAspectRatio) {
nextWidth = nextHeight = Math.max(nextWidth, nextHeight);
}
const [nextX1, nextY1, nextX2, nextY2] = getResizedElementAbsoluteCoords(
element,
nextWidth,
nextHeight,
);
const deltaX1 = (x1 - nextX1) / 2;
const deltaY1 = (y1 - nextY1) / 2;
const deltaX2 = (x2 - nextX2) / 2;
const deltaY2 = (y2 - nextY2) / 2;
const rescaledPoints = rescalePointsInElement(element, nextWidth, nextHeight);
updateBoundElements(element, {
newSize: { width: nextWidth, height: nextHeight },
});
const [finalX1, finalY1, finalX2, finalY2] = getResizedElementAbsoluteCoords(
{
...element,
...rescaledPoints,
},
Math.abs(nextWidth),
Math.abs(nextHeight),
);
const [flipDiffX, flipDiffY] = getFlipAdjustment(
transformHandleType,
nextWidth,
nextHeight,
nextX1,
nextY1,
nextX2,
nextY2,
finalX1,
finalY1,
finalX2,
finalY2,
isLinearElement(element),
element.angle,
);
const [nextElementX, nextElementY] = adjustXYWithRotation(
getSidesForTransformHandle(transformHandleType, isResizeFromCenter),
element.x - flipDiffX,
element.y - flipDiffY,
element.angle,
deltaX1,
deltaY1,
deltaX2,
deltaY2,
);
</s> add const resizedElement = {
width: Math.abs(eleNewWidth),
height: Math.abs(eleNewHeight),
x: newOrigin[0],
y: newOrigin[1],
...rescaledPoints,
}; </s> remove newTopLeft[1] += Math.abs(newHeight);
</s> add newTopLeft[1] += Math.abs(newBoundsHeight);
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep replace keep keep replace keep keep
|
<mask> if (transformHandleDirection.includes("e")) {
<mask> newWidth = rotatedPointer[0] - startTopLeft[0];
<mask> }
<mask> if (transformHandleDirection.includes("s")) {
<mask> newHeight = rotatedPointer[1] - startTopLeft[1];
<mask> }
<mask> if (transformHandleDirection.includes("w")) {
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove newWidth = startBottomRight[0] - rotatedPointer[0];
</s> add scaleX = (startBottomRight[0] - rotatedPointer[0]) / boundsCurrentWidth; </s> remove newHeight = startBottomRight[1] - rotatedPointer[1];
</s> add scaleY = (startBottomRight[1] - rotatedPointer[1]) / boundsCurrentHeight; </s> remove newTopLeft[0] += Math.abs(newWidth);
</s> add newTopLeft[0] += Math.abs(newBoundsWidth); </s> remove newTopLeft[1] = startCenter[1] - newHeight / 2;
</s> add newTopLeft[1] = startCenter[1] - newBoundsHeight / 2; </s> remove newTopLeft[0] = startCenter[0] - newWidth / 2;
</s> add newTopLeft[0] = startCenter[0] - newBoundsWidth / 2;
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep keep replace keep keep replace keep keep keep keep
|
<mask> }
<mask> if (transformHandleDirection.includes("w")) {
<mask> newWidth = startBottomRight[0] - rotatedPointer[0];
<mask> }
<mask> if (transformHandleDirection.includes("n")) {
<mask> newHeight = startBottomRight[1] - rotatedPointer[1];
<mask> }
<mask>
<mask> // adjust dimensions for resizing from center
<mask> if (isResizeFromCenter) {
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove newWidth = 2 * newWidth - stateAtResizeStart.width;
newHeight = 2 * newHeight - stateAtResizeStart.height;
</s> add eleNewWidth = 2 * eleNewWidth - eleInitialWidth;
eleNewHeight = 2 * eleNewHeight - eleInitialHeight; </s> remove newHeight = rotatedPointer[1] - startTopLeft[1];
</s> add scaleY = (rotatedPointer[1] - startTopLeft[1]) / boundsCurrentHeight; </s> add // Linear elements dimensions differ from bounds dimensions
const eleInitialWidth = stateAtResizeStart.width;
const eleInitialHeight = stateAtResizeStart.height;
// We have to use dimensions of element on screen, otherwise the scaling of the
// dimensions won't match the cursor for linear elements.
let eleNewWidth = element.width * scaleX;
let eleNewHeight = element.height * scaleY; </s> remove newWidth = rotatedPointer[0] - startTopLeft[0];
</s> add scaleX = (rotatedPointer[0] - startTopLeft[0]) / boundsCurrentWidth; </s> remove newTopLeft[1] += Math.abs(newHeight);
</s> add newTopLeft[1] += Math.abs(newBoundsHeight);
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep add keep keep keep keep
|
<mask> scaleY = (startBottomRight[1] - rotatedPointer[1]) / boundsCurrentHeight;
<mask> }
<mask>
<mask> // adjust dimensions for resizing from center
<mask> if (isResizeFromCenter) {
<mask> eleNewWidth = 2 * eleNewWidth - eleInitialWidth;
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove newHeight = startBottomRight[1] - rotatedPointer[1];
</s> add scaleY = (startBottomRight[1] - rotatedPointer[1]) / boundsCurrentHeight; </s> remove newWidth = 2 * newWidth - stateAtResizeStart.width;
newHeight = 2 * newHeight - stateAtResizeStart.height;
</s> add eleNewWidth = 2 * eleNewWidth - eleInitialWidth;
eleNewHeight = 2 * eleNewHeight - eleInitialHeight; </s> remove const widthRatio = Math.abs(newWidth) / stateAtResizeStart.width;
const heightRatio = Math.abs(newHeight) / stateAtResizeStart.height;
</s> add const widthRatio = Math.abs(eleNewWidth) / eleInitialWidth;
const heightRatio = Math.abs(eleNewHeight) / eleInitialHeight; </s> remove newHeight *= widthRatio;
newWidth *= heightRatio;
</s> add eleNewHeight *= widthRatio;
eleNewWidth *= heightRatio; </s> remove newWidth = stateAtResizeStart.width * ratio * Math.sign(newWidth);
newHeight = stateAtResizeStart.height * ratio * Math.sign(newHeight);
</s> add eleNewWidth = eleInitialWidth * ratio * Math.sign(eleNewWidth);
eleNewHeight = eleInitialHeight * ratio * Math.sign(eleNewHeight); </s> add //Get bounds corners rendered on screen
const [esx1, esy1, esx2, esy2] = getResizedElementAbsoluteCoords(
element,
element.width,
element.height,
);
const boundsCurrentWidth = esx2 - esx1;
const boundsCurrentHeight = esy2 - esy1;
// It's important we set the initial scale value based on the width and height at resize start,
// otherwise previous dimensions affected by modifiers will be taken into account.
const atStartBoundsWidth = startBottomRight[0] - startTopLeft[0];
const atStartBoundsHeight = startBottomRight[1] - startTopLeft[1];
let scaleX = atStartBoundsWidth / boundsCurrentWidth;
let scaleY = atStartBoundsHeight / boundsCurrentHeight;
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep keep keep replace replace keep keep keep keep replace replace keep keep keep
|
<mask>
<mask> // adjust dimensions for resizing from center
<mask> if (isResizeFromCenter) {
<mask> newWidth = 2 * newWidth - stateAtResizeStart.width;
<mask> newHeight = 2 * newHeight - stateAtResizeStart.height;
<mask> }
<mask>
<mask> // adjust dimensions to keep sides ratio
<mask> if (shouldKeepSidesRatio) {
<mask> const widthRatio = Math.abs(newWidth) / stateAtResizeStart.width;
<mask> const heightRatio = Math.abs(newHeight) / stateAtResizeStart.height;
<mask> if (transformHandleDirection.length === 1) {
<mask> newHeight *= widthRatio;
<mask> newWidth *= heightRatio;
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove newHeight *= widthRatio;
newWidth *= heightRatio;
</s> add eleNewHeight *= widthRatio;
eleNewWidth *= heightRatio; </s> remove newHeight = startBottomRight[1] - rotatedPointer[1];
</s> add scaleY = (startBottomRight[1] - rotatedPointer[1]) / boundsCurrentHeight; </s> add // Linear elements dimensions differ from bounds dimensions
const eleInitialWidth = stateAtResizeStart.width;
const eleInitialHeight = stateAtResizeStart.height;
// We have to use dimensions of element on screen, otherwise the scaling of the
// dimensions won't match the cursor for linear elements.
let eleNewWidth = element.width * scaleX;
let eleNewHeight = element.height * scaleY; </s> remove newWidth = stateAtResizeStart.width * ratio * Math.sign(newWidth);
newHeight = stateAtResizeStart.height * ratio * Math.sign(newHeight);
</s> add eleNewWidth = eleInitialWidth * ratio * Math.sign(eleNewWidth);
eleNewHeight = eleInitialHeight * ratio * Math.sign(eleNewHeight); </s> remove let newWidth = stateAtResizeStart.width;
let newHeight = stateAtResizeStart.height;
</s> add
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep keep keep keep replace replace keep keep keep replace replace keep keep keep
|
<mask> if (shouldKeepSidesRatio) {
<mask> const widthRatio = Math.abs(newWidth) / stateAtResizeStart.width;
<mask> const heightRatio = Math.abs(newHeight) / stateAtResizeStart.height;
<mask> if (transformHandleDirection.length === 1) {
<mask> newHeight *= widthRatio;
<mask> newWidth *= heightRatio;
<mask> }
<mask> if (transformHandleDirection.length === 2) {
<mask> const ratio = Math.max(widthRatio, heightRatio);
<mask> newWidth = stateAtResizeStart.width * ratio * Math.sign(newWidth);
<mask> newHeight = stateAtResizeStart.height * ratio * Math.sign(newHeight);
<mask> }
<mask> }
<mask>
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove const widthRatio = Math.abs(newWidth) / stateAtResizeStart.width;
const heightRatio = Math.abs(newHeight) / stateAtResizeStart.height;
</s> add const widthRatio = Math.abs(eleNewWidth) / eleInitialWidth;
const heightRatio = Math.abs(eleNewHeight) / eleInitialHeight; </s> remove newWidth = 2 * newWidth - stateAtResizeStart.width;
newHeight = 2 * newHeight - stateAtResizeStart.height;
</s> add eleNewWidth = 2 * eleNewWidth - eleInitialWidth;
eleNewHeight = 2 * eleNewHeight - eleInitialHeight; </s> remove newHeight = startBottomRight[1] - rotatedPointer[1];
</s> add scaleY = (startBottomRight[1] - rotatedPointer[1]) / boundsCurrentHeight; </s> remove export const getFlipAdjustment = (
side: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
nextWidth: number,
nextHeight: number,
nextX1: number,
nextY1: number,
nextX2: number,
nextY2: number,
finalX1: number,
finalY1: number,
finalX2: number,
finalY2: number,
needsRotation: boolean,
angle: number,
): [number, number] => {
const cos = Math.cos(angle);
const sin = Math.sin(angle);
let flipDiffX = 0;
let flipDiffY = 0;
if (nextWidth < 0) {
if (side === "e" || side === "ne" || side === "se") {
if (needsRotation) {
flipDiffX += (finalX2 - nextX1) * cos;
flipDiffY += (finalX2 - nextX1) * sin;
} else {
flipDiffX += finalX2 - nextX1;
}
}
if (side === "w" || side === "nw" || side === "sw") {
if (needsRotation) {
flipDiffX += (finalX1 - nextX2) * cos;
flipDiffY += (finalX1 - nextX2) * sin;
} else {
flipDiffX += finalX1 - nextX2;
}
}
}
if (nextHeight < 0) {
if (side === "s" || side === "se" || side === "sw") {
if (needsRotation) {
flipDiffY += (finalY2 - nextY1) * cos;
flipDiffX += (finalY2 - nextY1) * -sin;
} else {
flipDiffY += finalY2 - nextY1;
}
}
if (side === "n" || side === "ne" || side === "nw") {
if (needsRotation) {
flipDiffY += (finalY1 - nextY2) * cos;
flipDiffX += (finalY1 - nextY2) * -sin;
} else {
flipDiffY += finalY1 - nextY2;
}
}
}
return [flipDiffX, flipDiffY];
};
</s> add </s> remove let scaleX = 1;
let scaleY = 1;
if (
transformHandleType === "e" ||
transformHandleType === "ne" ||
transformHandleType === "se"
) {
scaleX = (rotatedX - x1) / (x2 - x1);
}
if (
transformHandleType === "s" ||
transformHandleType === "sw" ||
transformHandleType === "se"
) {
scaleY = (rotatedY - y1) / (y2 - y1);
}
if (
transformHandleType === "w" ||
transformHandleType === "nw" ||
transformHandleType === "sw"
) {
scaleX = (x2 - rotatedX) / (x2 - x1);
}
if (
transformHandleType === "n" ||
transformHandleType === "nw" ||
transformHandleType === "ne"
) {
scaleY = (y2 - rotatedY) / (y2 - y1);
}
let nextWidth = element.width * scaleX;
let nextHeight = element.height * scaleY;
if (keepSquareAspectRatio) {
nextWidth = nextHeight = Math.max(nextWidth, nextHeight);
}
const [nextX1, nextY1, nextX2, nextY2] = getResizedElementAbsoluteCoords(
element,
nextWidth,
nextHeight,
);
const deltaX1 = (x1 - nextX1) / 2;
const deltaY1 = (y1 - nextY1) / 2;
const deltaX2 = (x2 - nextX2) / 2;
const deltaY2 = (y2 - nextY2) / 2;
const rescaledPoints = rescalePointsInElement(element, nextWidth, nextHeight);
updateBoundElements(element, {
newSize: { width: nextWidth, height: nextHeight },
});
const [finalX1, finalY1, finalX2, finalY2] = getResizedElementAbsoluteCoords(
{
...element,
...rescaledPoints,
},
Math.abs(nextWidth),
Math.abs(nextHeight),
);
const [flipDiffX, flipDiffY] = getFlipAdjustment(
transformHandleType,
nextWidth,
nextHeight,
nextX1,
nextY1,
nextX2,
nextY2,
finalX1,
finalY1,
finalX2,
finalY2,
isLinearElement(element),
element.angle,
);
const [nextElementX, nextElementY] = adjustXYWithRotation(
getSidesForTransformHandle(transformHandleType, isResizeFromCenter),
element.x - flipDiffX,
element.y - flipDiffY,
element.angle,
deltaX1,
deltaY1,
deltaX2,
deltaY2,
);
</s> add const resizedElement = {
width: Math.abs(eleNewWidth),
height: Math.abs(eleNewHeight),
x: newOrigin[0],
y: newOrigin[1],
...rescaledPoints,
};
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep add keep keep keep keep keep keep
|
<mask> }
<mask>
<mask> // Calculate new topLeft based on fixed corner during resize
<mask> let newTopLeft = [...startTopLeft] as [number, number];
<mask> if (["n", "w", "nw"].includes(transformHandleDirection)) {
<mask> newTopLeft = [
<mask> startBottomRight[0] - Math.abs(newBoundsWidth),
<mask> startBottomRight[1] - Math.abs(newBoundsHeight),
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove let newTopLeft = startTopLeft as [number, number];
</s> add let newTopLeft = [...startTopLeft] as [number, number]; </s> remove startBottomRight[0] - Math.abs(newWidth),
startBottomRight[1] - Math.abs(newHeight),
</s> add startBottomRight[0] - Math.abs(newBoundsWidth),
startBottomRight[1] - Math.abs(newBoundsHeight), </s> remove newWidth = stateAtResizeStart.width * ratio * Math.sign(newWidth);
newHeight = stateAtResizeStart.height * ratio * Math.sign(newHeight);
</s> add eleNewWidth = eleInitialWidth * ratio * Math.sign(eleNewWidth);
eleNewHeight = eleInitialHeight * ratio * Math.sign(eleNewHeight); </s> remove const topRight = [
stateAtResizeStart.x + stateAtResizeStart.width,
stateAtResizeStart.y,
];
newTopLeft = [topRight[0] - Math.abs(newWidth), topRight[1]];
</s> add const topRight = [startBottomRight[0], startTopLeft[1]];
newTopLeft = [topRight[0] - Math.abs(newBoundsWidth), topRight[1]]; </s> remove const bottomLeft = [
stateAtResizeStart.x,
stateAtResizeStart.y + stateAtResizeStart.height,
];
newTopLeft = [bottomLeft[0], bottomLeft[1] - Math.abs(newHeight)];
</s> add const bottomLeft = [startTopLeft[0], startBottomRight[1]];
newTopLeft = [bottomLeft[0], bottomLeft[1] - Math.abs(newBoundsHeight)]; </s> add //Get bounds corners rendered on screen
const [esx1, esy1, esx2, esy2] = getResizedElementAbsoluteCoords(
element,
element.width,
element.height,
);
const boundsCurrentWidth = esx2 - esx1;
const boundsCurrentHeight = esy2 - esy1;
// It's important we set the initial scale value based on the width and height at resize start,
// otherwise previous dimensions affected by modifiers will be taken into account.
const atStartBoundsWidth = startBottomRight[0] - startTopLeft[0];
const atStartBoundsHeight = startBottomRight[1] - startTopLeft[1];
let scaleX = atStartBoundsWidth / boundsCurrentWidth;
let scaleY = atStartBoundsHeight / boundsCurrentHeight;
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep replace keep keep replace replace keep keep keep
|
<mask> // Calculate new topLeft based on fixed corner during resize
<mask> let newTopLeft = startTopLeft as [number, number];
<mask> if (["n", "w", "nw"].includes(transformHandleDirection)) {
<mask> newTopLeft = [
<mask> startBottomRight[0] - Math.abs(newWidth),
<mask> startBottomRight[1] - Math.abs(newHeight),
<mask> ];
<mask> }
<mask> if (transformHandleDirection === "ne") {
</s> improvement: Enhance resize for non generic elements (#2720) </s> add const [
newBoundsX1,
newBoundsY1,
newBoundsX2,
newBoundsY2,
] = getResizedElementAbsoluteCoords(
stateAtResizeStart,
eleNewWidth,
eleNewHeight,
);
const newBoundsWidth = newBoundsX2 - newBoundsX1;
const newBoundsHeight = newBoundsY2 - newBoundsY1;
</s> remove newWidth = stateAtResizeStart.width * ratio * Math.sign(newWidth);
newHeight = stateAtResizeStart.height * ratio * Math.sign(newHeight);
</s> add eleNewWidth = eleInitialWidth * ratio * Math.sign(eleNewWidth);
eleNewHeight = eleInitialHeight * ratio * Math.sign(eleNewHeight); </s> remove const bottomLeft = [
stateAtResizeStart.x,
stateAtResizeStart.y + stateAtResizeStart.height,
];
newTopLeft = [bottomLeft[0], bottomLeft[1] - Math.abs(newHeight)];
</s> add const bottomLeft = [startTopLeft[0], startBottomRight[1]];
newTopLeft = [bottomLeft[0], bottomLeft[1] - Math.abs(newBoundsHeight)]; </s> remove const topRight = [
stateAtResizeStart.x + stateAtResizeStart.width,
stateAtResizeStart.y,
];
newTopLeft = [topRight[0] - Math.abs(newWidth), topRight[1]];
</s> add const topRight = [startBottomRight[0], startTopLeft[1]];
newTopLeft = [topRight[0] - Math.abs(newBoundsWidth), topRight[1]]; </s> remove newTopLeft[0] = startCenter[0] - newWidth / 2;
</s> add newTopLeft[0] = startCenter[0] - newBoundsWidth / 2;
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep keep keep keep replace replace replace replace replace keep keep replace replace replace replace replace keep keep
|
<mask> startBottomRight[1] - Math.abs(newHeight),
<mask> ];
<mask> }
<mask> if (transformHandleDirection === "ne") {
<mask> const bottomLeft = [
<mask> stateAtResizeStart.x,
<mask> stateAtResizeStart.y + stateAtResizeStart.height,
<mask> ];
<mask> newTopLeft = [bottomLeft[0], bottomLeft[1] - Math.abs(newHeight)];
<mask> }
<mask> if (transformHandleDirection === "sw") {
<mask> const topRight = [
<mask> stateAtResizeStart.x + stateAtResizeStart.width,
<mask> stateAtResizeStart.y,
<mask> ];
<mask> newTopLeft = [topRight[0] - Math.abs(newWidth), topRight[1]];
<mask> }
<mask>
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove startBottomRight[0] - Math.abs(newWidth),
startBottomRight[1] - Math.abs(newHeight),
</s> add startBottomRight[0] - Math.abs(newBoundsWidth),
startBottomRight[1] - Math.abs(newBoundsHeight), </s> remove let newTopLeft = startTopLeft as [number, number];
</s> add let newTopLeft = [...startTopLeft] as [number, number]; </s> remove newTopLeft[0] + Math.abs(newWidth) / 2,
newTopLeft[1] + Math.abs(newHeight) / 2,
</s> add newTopLeft[0] + Math.abs(newBoundsWidth) / 2,
newTopLeft[1] + Math.abs(newBoundsHeight) / 2, </s> add const [
newBoundsX1,
newBoundsY1,
newBoundsX2,
newBoundsY2,
] = getResizedElementAbsoluteCoords(
stateAtResizeStart,
eleNewWidth,
eleNewHeight,
);
const newBoundsWidth = newBoundsX2 - newBoundsX1;
const newBoundsHeight = newBoundsY2 - newBoundsY1;
</s> remove const resizedElement = {
width: Math.abs(newWidth),
height: Math.abs(newHeight),
x: newTopLeft[0],
y: newTopLeft[1],
};
updateBoundElements(element, {
newSize: { width: resizedElement.width, height: resizedElement.height },
});
mutateElement(element, resizedElement);
};
const resizeSingleNonGenericElement = (
element: NonDeleted<Exclude<ExcalidrawElement, ExcalidrawGenericElement>>,
transformHandleType: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
isResizeFromCenter: boolean,
keepSquareAspectRatio: boolean,
pointerX: number,
pointerY: number,
) => {
const [x1, y1, x2, y2] = getElementAbsoluteCoords(element);
const cx = (x1 + x2) / 2;
const cy = (y1 + y2) / 2;
// rotation pointer with reverse angle
const [rotatedX, rotatedY] = rotate(
pointerX,
pointerY,
cx,
cy,
-element.angle,
</s> add // Readjust points for linear elements
const rescaledPoints = rescalePointsInElement(
stateAtResizeStart,
eleNewWidth,
eleNewHeight,
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep replace keep keep replace
|
<mask> if (["s", "n"].includes(transformHandleDirection)) {
<mask> newTopLeft[0] = startCenter[0] - newWidth / 2;
<mask> }
<mask> if (["e", "w"].includes(transformHandleDirection)) {
<mask> newTopLeft[1] = startCenter[1] - newHeight / 2;
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove newTopLeft[0] = startCenter[0] - Math.abs(newWidth) / 2;
newTopLeft[1] = startCenter[1] - Math.abs(newHeight) / 2;
</s> add newTopLeft[0] = startCenter[0] - Math.abs(newBoundsWidth) / 2;
newTopLeft[1] = startCenter[1] - Math.abs(newBoundsHeight) / 2; </s> remove newTopLeft[1] += Math.abs(newHeight);
</s> add newTopLeft[1] += Math.abs(newBoundsHeight); </s> remove newHeight = rotatedPointer[1] - startTopLeft[1];
</s> add scaleY = (rotatedPointer[1] - startTopLeft[1]) / boundsCurrentHeight; </s> remove newWidth = startBottomRight[0] - rotatedPointer[0];
</s> add scaleX = (startBottomRight[0] - rotatedPointer[0]) / boundsCurrentWidth; </s> remove const topRight = [
stateAtResizeStart.x + stateAtResizeStart.width,
stateAtResizeStart.y,
];
newTopLeft = [topRight[0] - Math.abs(newWidth), topRight[1]];
</s> add const topRight = [startBottomRight[0], startTopLeft[1]];
newTopLeft = [topRight[0] - Math.abs(newBoundsWidth), topRight[1]];
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep keep replace keep replace keep
|
<mask>
<mask> // Flip horizontally
<mask> if (newWidth < 0) {
<mask> if (transformHandleDirection.includes("e")) {
<mask> newTopLeft[0] -= Math.abs(newWidth);
<mask> }
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove newTopLeft[0] += Math.abs(newWidth);
</s> add newTopLeft[0] += Math.abs(newBoundsWidth); </s> remove if (newHeight < 0) {
</s> add if (eleNewHeight < 0) { </s> remove newTopLeft[1] = startCenter[1] - newHeight / 2;
</s> add newTopLeft[1] = startCenter[1] - newBoundsHeight / 2; </s> remove newTopLeft[1] -= Math.abs(newHeight);
</s> add newTopLeft[1] -= Math.abs(newBoundsHeight); </s> remove newTopLeft[1] += Math.abs(newHeight);
</s> add newTopLeft[1] += Math.abs(newBoundsHeight);
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep keep replace keep keep keep replace keep keep keep keep
|
<mask> }
<mask> if (transformHandleDirection.includes("w")) {
<mask> newTopLeft[0] += Math.abs(newWidth);
<mask> }
<mask> }
<mask> // Flip vertically
<mask> if (newHeight < 0) {
<mask> if (transformHandleDirection.includes("s")) {
<mask> newTopLeft[1] -= Math.abs(newHeight);
<mask> }
<mask> if (transformHandleDirection.includes("n")) {
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove newTopLeft[1] -= Math.abs(newHeight);
</s> add newTopLeft[1] -= Math.abs(newBoundsHeight); </s> remove if (newWidth < 0) {
</s> add if (eleNewWidth < 0) { </s> remove newTopLeft[0] -= Math.abs(newWidth);
</s> add newTopLeft[0] -= Math.abs(newBoundsWidth); </s> remove newTopLeft[1] += Math.abs(newHeight);
</s> add newTopLeft[1] += Math.abs(newBoundsHeight); </s> remove newTopLeft[1] = startCenter[1] - newHeight / 2;
</s> add newTopLeft[1] = startCenter[1] - newBoundsHeight / 2;
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep keep keep replace keep keep replace keep
|
<mask> // Flip vertically
<mask> if (newHeight < 0) {
<mask> if (transformHandleDirection.includes("s")) {
<mask> newTopLeft[1] -= Math.abs(newHeight);
<mask> }
<mask> if (transformHandleDirection.includes("n")) {
<mask> newTopLeft[1] += Math.abs(newHeight);
<mask> }
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove if (newHeight < 0) {
</s> add if (eleNewHeight < 0) { </s> remove newTopLeft[0] += Math.abs(newWidth);
</s> add newTopLeft[0] += Math.abs(newBoundsWidth); </s> remove if (newWidth < 0) {
</s> add if (eleNewWidth < 0) { </s> remove newTopLeft[0] -= Math.abs(newWidth);
</s> add newTopLeft[0] -= Math.abs(newBoundsWidth); </s> remove newTopLeft[1] = startCenter[1] - newHeight / 2;
</s> add newTopLeft[1] = startCenter[1] - newBoundsHeight / 2;
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> }
<mask> }
<mask>
<mask> if (isResizeFromCenter) {
<mask> newTopLeft[0] = startCenter[0] - Math.abs(newWidth) / 2;
<mask> newTopLeft[1] = startCenter[1] - Math.abs(newHeight) / 2;
<mask> }
<mask>
<mask> // adjust topLeft to new rotation point
<mask> const angle = stateAtResizeStart.angle;
<mask> const rotatedTopLeft = rotatePoint(newTopLeft, startCenter, angle);
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove newTopLeft[0] + Math.abs(newWidth) / 2,
newTopLeft[1] + Math.abs(newHeight) / 2,
</s> add newTopLeft[0] + Math.abs(newBoundsWidth) / 2,
newTopLeft[1] + Math.abs(newBoundsHeight) / 2, </s> remove newTopLeft[1] = startCenter[1] - newHeight / 2;
</s> add newTopLeft[1] = startCenter[1] - newBoundsHeight / 2; </s> remove newTopLeft[0] = startCenter[0] - newWidth / 2;
</s> add newTopLeft[0] = startCenter[0] - newBoundsWidth / 2; </s> remove newTopLeft[1] += Math.abs(newHeight);
</s> add newTopLeft[1] += Math.abs(newBoundsHeight); </s> remove const widthRatio = Math.abs(newWidth) / stateAtResizeStart.width;
const heightRatio = Math.abs(newHeight) / stateAtResizeStart.height;
</s> add const widthRatio = Math.abs(eleNewWidth) / eleInitialWidth;
const heightRatio = Math.abs(eleNewHeight) / eleInitialHeight; </s> remove newWidth = 2 * newWidth - stateAtResizeStart.width;
newHeight = 2 * newHeight - stateAtResizeStart.height;
</s> add eleNewWidth = 2 * eleNewWidth - eleInitialWidth;
eleNewHeight = 2 * eleNewHeight - eleInitialHeight;
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep keep keep keep replace replace keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep
|
<mask> // adjust topLeft to new rotation point
<mask> const angle = stateAtResizeStart.angle;
<mask> const rotatedTopLeft = rotatePoint(newTopLeft, startCenter, angle);
<mask> const newCenter: Point = [
<mask> newTopLeft[0] + Math.abs(newWidth) / 2,
<mask> newTopLeft[1] + Math.abs(newHeight) / 2,
<mask> ];
<mask> const rotatedNewCenter = rotatePoint(newCenter, startCenter, angle);
<mask> newTopLeft = rotatePoint(rotatedTopLeft, rotatedNewCenter, -angle);
<mask>
<mask> const resizedElement = {
<mask> width: Math.abs(newWidth),
<mask> height: Math.abs(newHeight),
<mask> x: newTopLeft[0],
<mask> y: newTopLeft[1],
<mask> };
<mask> updateBoundElements(element, {
<mask> newSize: { width: resizedElement.width, height: resizedElement.height },
<mask> });
<mask> mutateElement(element, resizedElement);
<mask> };
<mask>
<mask> const resizeSingleNonGenericElement = (
<mask> element: NonDeleted<Exclude<ExcalidrawElement, ExcalidrawGenericElement>>,
<mask> transformHandleType: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
<mask> isResizeFromCenter: boolean,
<mask> keepSquareAspectRatio: boolean,
<mask> pointerX: number,
<mask> pointerY: number,
<mask> ) => {
<mask> const [x1, y1, x2, y2] = getElementAbsoluteCoords(element);
<mask> const cx = (x1 + x2) / 2;
<mask> const cy = (y1 + y2) / 2;
<mask>
<mask> // rotation pointer with reverse angle
<mask> const [rotatedX, rotatedY] = rotate(
<mask> pointerX,
<mask> pointerY,
<mask> cx,
<mask> cy,
<mask> -element.angle,
<mask> );
</s> improvement: Enhance resize for non generic elements (#2720) </s> add mutateElement(element, resizedElement); </s> remove newTopLeft[0] = startCenter[0] - Math.abs(newWidth) / 2;
newTopLeft[1] = startCenter[1] - Math.abs(newHeight) / 2;
</s> add newTopLeft[0] = startCenter[0] - Math.abs(newBoundsWidth) / 2;
newTopLeft[1] = startCenter[1] - Math.abs(newBoundsHeight) / 2; </s> remove const [x1, y1, x2, y2] = getElementAbsoluteCoords(stateAtResizeStart);
</s> add // Gets bounds corners
const [x1, y1, x2, y2] = getResizedElementAbsoluteCoords(
stateAtResizeStart,
stateAtResizeStart.width,
stateAtResizeStart.height,
); </s> remove export const getFlipAdjustment = (
side: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
nextWidth: number,
nextHeight: number,
nextX1: number,
nextY1: number,
nextX2: number,
nextY2: number,
finalX1: number,
finalY1: number,
finalX2: number,
finalY2: number,
needsRotation: boolean,
angle: number,
): [number, number] => {
const cos = Math.cos(angle);
const sin = Math.sin(angle);
let flipDiffX = 0;
let flipDiffY = 0;
if (nextWidth < 0) {
if (side === "e" || side === "ne" || side === "se") {
if (needsRotation) {
flipDiffX += (finalX2 - nextX1) * cos;
flipDiffY += (finalX2 - nextX1) * sin;
} else {
flipDiffX += finalX2 - nextX1;
}
}
if (side === "w" || side === "nw" || side === "sw") {
if (needsRotation) {
flipDiffX += (finalX1 - nextX2) * cos;
flipDiffY += (finalX1 - nextX2) * sin;
} else {
flipDiffX += finalX1 - nextX2;
}
}
}
if (nextHeight < 0) {
if (side === "s" || side === "se" || side === "sw") {
if (needsRotation) {
flipDiffY += (finalY2 - nextY1) * cos;
flipDiffX += (finalY2 - nextY1) * -sin;
} else {
flipDiffY += finalY2 - nextY1;
}
}
if (side === "n" || side === "ne" || side === "nw") {
if (needsRotation) {
flipDiffY += (finalY1 - nextY2) * cos;
flipDiffX += (finalY1 - nextY2) * -sin;
} else {
flipDiffY += finalY1 - nextY2;
}
}
}
return [flipDiffX, flipDiffY];
};
</s> add </s> remove let scaleX = 1;
let scaleY = 1;
if (
transformHandleType === "e" ||
transformHandleType === "ne" ||
transformHandleType === "se"
) {
scaleX = (rotatedX - x1) / (x2 - x1);
}
if (
transformHandleType === "s" ||
transformHandleType === "sw" ||
transformHandleType === "se"
) {
scaleY = (rotatedY - y1) / (y2 - y1);
}
if (
transformHandleType === "w" ||
transformHandleType === "nw" ||
transformHandleType === "sw"
) {
scaleX = (x2 - rotatedX) / (x2 - x1);
}
if (
transformHandleType === "n" ||
transformHandleType === "nw" ||
transformHandleType === "ne"
) {
scaleY = (y2 - rotatedY) / (y2 - y1);
}
let nextWidth = element.width * scaleX;
let nextHeight = element.height * scaleY;
if (keepSquareAspectRatio) {
nextWidth = nextHeight = Math.max(nextWidth, nextHeight);
}
const [nextX1, nextY1, nextX2, nextY2] = getResizedElementAbsoluteCoords(
element,
nextWidth,
nextHeight,
);
const deltaX1 = (x1 - nextX1) / 2;
const deltaY1 = (y1 - nextY1) / 2;
const deltaX2 = (x2 - nextX2) / 2;
const deltaY2 = (y2 - nextY2) / 2;
const rescaledPoints = rescalePointsInElement(element, nextWidth, nextHeight);
updateBoundElements(element, {
newSize: { width: nextWidth, height: nextHeight },
});
const [finalX1, finalY1, finalX2, finalY2] = getResizedElementAbsoluteCoords(
{
...element,
...rescaledPoints,
},
Math.abs(nextWidth),
Math.abs(nextHeight),
);
const [flipDiffX, flipDiffY] = getFlipAdjustment(
transformHandleType,
nextWidth,
nextHeight,
nextX1,
nextY1,
nextX2,
nextY2,
finalX1,
finalY1,
finalX2,
finalY2,
isLinearElement(element),
element.angle,
);
const [nextElementX, nextElementY] = adjustXYWithRotation(
getSidesForTransformHandle(transformHandleType, isResizeFromCenter),
element.x - flipDiffX,
element.y - flipDiffY,
element.angle,
deltaX1,
deltaY1,
deltaX2,
deltaY2,
);
</s> add const resizedElement = {
width: Math.abs(eleNewWidth),
height: Math.abs(eleNewHeight),
x: newOrigin[0],
y: newOrigin[1],
...rescaledPoints,
};
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep add keep keep keep keep
|
<mask> eleNewHeight,
<mask> );
<mask>
<mask> const resizedElement = {
<mask> width: Math.abs(eleNewWidth),
<mask> height: Math.abs(eleNewHeight),
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove const resizedElement = {
width: Math.abs(newWidth),
height: Math.abs(newHeight),
x: newTopLeft[0],
y: newTopLeft[1],
};
updateBoundElements(element, {
newSize: { width: resizedElement.width, height: resizedElement.height },
});
mutateElement(element, resizedElement);
};
const resizeSingleNonGenericElement = (
element: NonDeleted<Exclude<ExcalidrawElement, ExcalidrawGenericElement>>,
transformHandleType: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
isResizeFromCenter: boolean,
keepSquareAspectRatio: boolean,
pointerX: number,
pointerY: number,
) => {
const [x1, y1, x2, y2] = getElementAbsoluteCoords(element);
const cx = (x1 + x2) / 2;
const cy = (y1 + y2) / 2;
// rotation pointer with reverse angle
const [rotatedX, rotatedY] = rotate(
pointerX,
pointerY,
cx,
cy,
-element.angle,
</s> add // Readjust points for linear elements
const rescaledPoints = rescalePointsInElement(
stateAtResizeStart,
eleNewWidth,
eleNewHeight, </s> remove let scaleX = 1;
let scaleY = 1;
if (
transformHandleType === "e" ||
transformHandleType === "ne" ||
transformHandleType === "se"
) {
scaleX = (rotatedX - x1) / (x2 - x1);
}
if (
transformHandleType === "s" ||
transformHandleType === "sw" ||
transformHandleType === "se"
) {
scaleY = (rotatedY - y1) / (y2 - y1);
}
if (
transformHandleType === "w" ||
transformHandleType === "nw" ||
transformHandleType === "sw"
) {
scaleX = (x2 - rotatedX) / (x2 - x1);
}
if (
transformHandleType === "n" ||
transformHandleType === "nw" ||
transformHandleType === "ne"
) {
scaleY = (y2 - rotatedY) / (y2 - y1);
}
let nextWidth = element.width * scaleX;
let nextHeight = element.height * scaleY;
if (keepSquareAspectRatio) {
nextWidth = nextHeight = Math.max(nextWidth, nextHeight);
}
const [nextX1, nextY1, nextX2, nextY2] = getResizedElementAbsoluteCoords(
element,
nextWidth,
nextHeight,
);
const deltaX1 = (x1 - nextX1) / 2;
const deltaY1 = (y1 - nextY1) / 2;
const deltaX2 = (x2 - nextX2) / 2;
const deltaY2 = (y2 - nextY2) / 2;
const rescaledPoints = rescalePointsInElement(element, nextWidth, nextHeight);
updateBoundElements(element, {
newSize: { width: nextWidth, height: nextHeight },
});
const [finalX1, finalY1, finalX2, finalY2] = getResizedElementAbsoluteCoords(
{
...element,
...rescaledPoints,
},
Math.abs(nextWidth),
Math.abs(nextHeight),
);
const [flipDiffX, flipDiffY] = getFlipAdjustment(
transformHandleType,
nextWidth,
nextHeight,
nextX1,
nextY1,
nextX2,
nextY2,
finalX1,
finalY1,
finalX2,
finalY2,
isLinearElement(element),
element.angle,
);
const [nextElementX, nextElementY] = adjustXYWithRotation(
getSidesForTransformHandle(transformHandleType, isResizeFromCenter),
element.x - flipDiffX,
element.y - flipDiffY,
element.angle,
deltaX1,
deltaY1,
deltaX2,
deltaY2,
);
</s> add const resizedElement = {
width: Math.abs(eleNewWidth),
height: Math.abs(eleNewHeight),
x: newOrigin[0],
y: newOrigin[1],
...rescaledPoints,
}; </s> remove mutateElement(element, {
width: nextWidth,
height: nextHeight,
x: nextElementX,
y: nextElementY,
...rescaledPoints,
</s> add updateBoundElements(element, {
newSize: { width: resizedElement.width, height: resizedElement.height }, </s> remove if (isGenericElement(element)) {
resizeSingleGenericElement(
pointerDownState.originalElements.get(element.id) as typeof element,
shouldKeepSidesRatio,
element,
transformHandleType,
isResizeCenterPoint,
pointerX,
pointerY,
);
} else {
const keepSquareAspectRatio = shouldKeepSidesRatio;
resizeSingleNonGenericElement(
element,
transformHandleType,
isResizeCenterPoint,
keepSquareAspectRatio,
pointerX,
pointerY,
);
setTransformHandle(
normalizeTransformHandleType(element, transformHandleType),
);
if (element.width < 0) {
mutateElement(element, { width: -element.width });
}
if (element.height < 0) {
mutateElement(element, { height: -element.height });
}
}
</s> add resizeSingleElement(
pointerDownState.originalElements.get(element.id) as typeof element,
shouldKeepSidesRatio,
element,
transformHandleType,
isResizeCenterPoint,
pointerX,
pointerY,
); </s> add mutateElement(element, resizedElement); </s> add const [
newBoundsX1,
newBoundsY1,
newBoundsX2,
newBoundsY2,
] = getResizedElementAbsoluteCoords(
stateAtResizeStart,
eleNewWidth,
eleNewHeight,
);
const newBoundsWidth = newBoundsX2 - newBoundsX1;
const newBoundsHeight = newBoundsY2 - newBoundsY1;
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep replace replace replace replace keep keep
|
<mask> -element.angle,
<mask> );
<mask>
<mask> let scaleX = 1;
<mask> let scaleY = 1;
<mask> if (
<mask> transformHandleType === "e" ||
<mask> transformHandleType === "ne" ||
<mask> transformHandleType === "se"
<mask> ) {
<mask> scaleX = (rotatedX - x1) / (x2 - x1);
<mask> }
<mask> if (
<mask> transformHandleType === "s" ||
<mask> transformHandleType === "sw" ||
<mask> transformHandleType === "se"
<mask> ) {
<mask> scaleY = (rotatedY - y1) / (y2 - y1);
<mask> }
<mask> if (
<mask> transformHandleType === "w" ||
<mask> transformHandleType === "nw" ||
<mask> transformHandleType === "sw"
<mask> ) {
<mask> scaleX = (x2 - rotatedX) / (x2 - x1);
<mask> }
<mask> if (
<mask> transformHandleType === "n" ||
<mask> transformHandleType === "nw" ||
<mask> transformHandleType === "ne"
<mask> ) {
<mask> scaleY = (y2 - rotatedY) / (y2 - y1);
<mask> }
<mask> let nextWidth = element.width * scaleX;
<mask> let nextHeight = element.height * scaleY;
<mask> if (keepSquareAspectRatio) {
<mask> nextWidth = nextHeight = Math.max(nextWidth, nextHeight);
<mask> }
<mask>
<mask> const [nextX1, nextY1, nextX2, nextY2] = getResizedElementAbsoluteCoords(
<mask> element,
<mask> nextWidth,
<mask> nextHeight,
<mask> );
<mask> const deltaX1 = (x1 - nextX1) / 2;
<mask> const deltaY1 = (y1 - nextY1) / 2;
<mask> const deltaX2 = (x2 - nextX2) / 2;
<mask> const deltaY2 = (y2 - nextY2) / 2;
<mask>
<mask> const rescaledPoints = rescalePointsInElement(element, nextWidth, nextHeight);
<mask>
<mask> updateBoundElements(element, {
<mask> newSize: { width: nextWidth, height: nextHeight },
<mask> });
<mask> const [finalX1, finalY1, finalX2, finalY2] = getResizedElementAbsoluteCoords(
<mask> {
<mask> ...element,
<mask> ...rescaledPoints,
<mask> },
<mask> Math.abs(nextWidth),
<mask> Math.abs(nextHeight),
<mask> );
<mask> const [flipDiffX, flipDiffY] = getFlipAdjustment(
<mask> transformHandleType,
<mask> nextWidth,
<mask> nextHeight,
<mask> nextX1,
<mask> nextY1,
<mask> nextX2,
<mask> nextY2,
<mask> finalX1,
<mask> finalY1,
<mask> finalX2,
<mask> finalY2,
<mask> isLinearElement(element),
<mask> element.angle,
<mask> );
<mask> const [nextElementX, nextElementY] = adjustXYWithRotation(
<mask> getSidesForTransformHandle(transformHandleType, isResizeFromCenter),
<mask> element.x - flipDiffX,
<mask> element.y - flipDiffY,
<mask> element.angle,
<mask> deltaX1,
<mask> deltaY1,
<mask> deltaX2,
<mask> deltaY2,
<mask> );
<mask>
<mask> if (
<mask> nextWidth !== 0 &&
<mask> nextHeight !== 0 &&
<mask> Number.isFinite(nextElementX) &&
<mask> Number.isFinite(nextElementY)
<mask> ) {
<mask> mutateElement(element, {
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove export const getFlipAdjustment = (
side: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
nextWidth: number,
nextHeight: number,
nextX1: number,
nextY1: number,
nextX2: number,
nextY2: number,
finalX1: number,
finalY1: number,
finalX2: number,
finalY2: number,
needsRotation: boolean,
angle: number,
): [number, number] => {
const cos = Math.cos(angle);
const sin = Math.sin(angle);
let flipDiffX = 0;
let flipDiffY = 0;
if (nextWidth < 0) {
if (side === "e" || side === "ne" || side === "se") {
if (needsRotation) {
flipDiffX += (finalX2 - nextX1) * cos;
flipDiffY += (finalX2 - nextX1) * sin;
} else {
flipDiffX += finalX2 - nextX1;
}
}
if (side === "w" || side === "nw" || side === "sw") {
if (needsRotation) {
flipDiffX += (finalX1 - nextX2) * cos;
flipDiffY += (finalX1 - nextX2) * sin;
} else {
flipDiffX += finalX1 - nextX2;
}
}
}
if (nextHeight < 0) {
if (side === "s" || side === "se" || side === "sw") {
if (needsRotation) {
flipDiffY += (finalY2 - nextY1) * cos;
flipDiffX += (finalY2 - nextY1) * -sin;
} else {
flipDiffY += finalY2 - nextY1;
}
}
if (side === "n" || side === "ne" || side === "nw") {
if (needsRotation) {
flipDiffY += (finalY1 - nextY2) * cos;
flipDiffX += (finalY1 - nextY2) * -sin;
} else {
flipDiffY += finalY1 - nextY2;
}
}
}
return [flipDiffX, flipDiffY];
};
</s> add </s> remove mutateElement(element, {
width: nextWidth,
height: nextHeight,
x: nextElementX,
y: nextElementY,
...rescaledPoints,
</s> add updateBoundElements(element, {
newSize: { width: resizedElement.width, height: resizedElement.height }, </s> remove const resizedElement = {
width: Math.abs(newWidth),
height: Math.abs(newHeight),
x: newTopLeft[0],
y: newTopLeft[1],
};
updateBoundElements(element, {
newSize: { width: resizedElement.width, height: resizedElement.height },
});
mutateElement(element, resizedElement);
};
const resizeSingleNonGenericElement = (
element: NonDeleted<Exclude<ExcalidrawElement, ExcalidrawGenericElement>>,
transformHandleType: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
isResizeFromCenter: boolean,
keepSquareAspectRatio: boolean,
pointerX: number,
pointerY: number,
) => {
const [x1, y1, x2, y2] = getElementAbsoluteCoords(element);
const cx = (x1 + x2) / 2;
const cy = (y1 + y2) / 2;
// rotation pointer with reverse angle
const [rotatedX, rotatedY] = rotate(
pointerX,
pointerY,
cx,
cy,
-element.angle,
</s> add // Readjust points for linear elements
const rescaledPoints = rescalePointsInElement(
stateAtResizeStart,
eleNewWidth,
eleNewHeight, </s> add //Get bounds corners rendered on screen
const [esx1, esy1, esx2, esy2] = getResizedElementAbsoluteCoords(
element,
element.width,
element.height,
);
const boundsCurrentWidth = esx2 - esx1;
const boundsCurrentHeight = esy2 - esy1;
// It's important we set the initial scale value based on the width and height at resize start,
// otherwise previous dimensions affected by modifiers will be taken into account.
const atStartBoundsWidth = startBottomRight[0] - startTopLeft[0];
const atStartBoundsHeight = startBottomRight[1] - startTopLeft[1];
let scaleX = atStartBoundsWidth / boundsCurrentWidth;
let scaleY = atStartBoundsHeight / boundsCurrentHeight;
</s> remove newHeight *= widthRatio;
newWidth *= heightRatio;
</s> add eleNewHeight *= widthRatio;
eleNewWidth *= heightRatio;
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
|
<mask> nextHeight !== 0 &&
<mask> Number.isFinite(nextElementX) &&
<mask> Number.isFinite(nextElementY)
<mask> ) {
<mask> mutateElement(element, {
<mask> width: nextWidth,
<mask> height: nextHeight,
<mask> x: nextElementX,
<mask> y: nextElementY,
<mask> ...rescaledPoints,
<mask> });
<mask> }
<mask> };
<mask>
<mask> const resizeMultipleElements = (
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove nextWidth !== 0 &&
nextHeight !== 0 &&
Number.isFinite(nextElementX) &&
Number.isFinite(nextElementY)
</s> add resizedElement.width !== 0 &&
resizedElement.height !== 0 &&
Number.isFinite(resizedElement.x) &&
Number.isFinite(resizedElement.y) </s> remove let scaleX = 1;
let scaleY = 1;
if (
transformHandleType === "e" ||
transformHandleType === "ne" ||
transformHandleType === "se"
) {
scaleX = (rotatedX - x1) / (x2 - x1);
}
if (
transformHandleType === "s" ||
transformHandleType === "sw" ||
transformHandleType === "se"
) {
scaleY = (rotatedY - y1) / (y2 - y1);
}
if (
transformHandleType === "w" ||
transformHandleType === "nw" ||
transformHandleType === "sw"
) {
scaleX = (x2 - rotatedX) / (x2 - x1);
}
if (
transformHandleType === "n" ||
transformHandleType === "nw" ||
transformHandleType === "ne"
) {
scaleY = (y2 - rotatedY) / (y2 - y1);
}
let nextWidth = element.width * scaleX;
let nextHeight = element.height * scaleY;
if (keepSquareAspectRatio) {
nextWidth = nextHeight = Math.max(nextWidth, nextHeight);
}
const [nextX1, nextY1, nextX2, nextY2] = getResizedElementAbsoluteCoords(
element,
nextWidth,
nextHeight,
);
const deltaX1 = (x1 - nextX1) / 2;
const deltaY1 = (y1 - nextY1) / 2;
const deltaX2 = (x2 - nextX2) / 2;
const deltaY2 = (y2 - nextY2) / 2;
const rescaledPoints = rescalePointsInElement(element, nextWidth, nextHeight);
updateBoundElements(element, {
newSize: { width: nextWidth, height: nextHeight },
});
const [finalX1, finalY1, finalX2, finalY2] = getResizedElementAbsoluteCoords(
{
...element,
...rescaledPoints,
},
Math.abs(nextWidth),
Math.abs(nextHeight),
);
const [flipDiffX, flipDiffY] = getFlipAdjustment(
transformHandleType,
nextWidth,
nextHeight,
nextX1,
nextY1,
nextX2,
nextY2,
finalX1,
finalY1,
finalX2,
finalY2,
isLinearElement(element),
element.angle,
);
const [nextElementX, nextElementY] = adjustXYWithRotation(
getSidesForTransformHandle(transformHandleType, isResizeFromCenter),
element.x - flipDiffX,
element.y - flipDiffY,
element.angle,
deltaX1,
deltaY1,
deltaX2,
deltaY2,
);
</s> add const resizedElement = {
width: Math.abs(eleNewWidth),
height: Math.abs(eleNewHeight),
x: newOrigin[0],
y: newOrigin[1],
...rescaledPoints,
}; </s> add mutateElement(element, resizedElement); </s> remove const resizedElement = {
width: Math.abs(newWidth),
height: Math.abs(newHeight),
x: newTopLeft[0],
y: newTopLeft[1],
};
updateBoundElements(element, {
newSize: { width: resizedElement.width, height: resizedElement.height },
});
mutateElement(element, resizedElement);
};
const resizeSingleNonGenericElement = (
element: NonDeleted<Exclude<ExcalidrawElement, ExcalidrawGenericElement>>,
transformHandleType: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
isResizeFromCenter: boolean,
keepSquareAspectRatio: boolean,
pointerX: number,
pointerY: number,
) => {
const [x1, y1, x2, y2] = getElementAbsoluteCoords(element);
const cx = (x1 + x2) / 2;
const cy = (y1 + y2) / 2;
// rotation pointer with reverse angle
const [rotatedX, rotatedY] = rotate(
pointerX,
pointerY,
cx,
cy,
-element.angle,
</s> add // Readjust points for linear elements
const rescaledPoints = rescalePointsInElement(
stateAtResizeStart,
eleNewWidth,
eleNewHeight, </s> remove
export const normalizeTransformHandleType = (
element: ExcalidrawElement,
transformHandleType: TransformHandleType,
): TransformHandleType => {
if (element.width >= 0 && element.height >= 0) {
return transformHandleType;
}
if (element.width < 0 && element.height < 0) {
switch (transformHandleType) {
case "nw":
return "se";
case "ne":
return "sw";
case "se":
return "nw";
case "sw":
return "ne";
}
} else if (element.width < 0) {
switch (transformHandleType) {
case "nw":
return "ne";
case "ne":
return "nw";
case "se":
return "sw";
case "sw":
return "se";
case "e":
return "w";
case "w":
return "e";
}
} else {
switch (transformHandleType) {
case "nw":
return "sw";
case "ne":
return "se";
case "se":
return "ne";
case "sw":
return "nw";
case "n":
return "s";
case "s":
return "n";
}
}
return transformHandleType;
};
</s> add </s> remove if (isGenericElement(element)) {
resizeSingleGenericElement(
pointerDownState.originalElements.get(element.id) as typeof element,
shouldKeepSidesRatio,
element,
transformHandleType,
isResizeCenterPoint,
pointerX,
pointerY,
);
} else {
const keepSquareAspectRatio = shouldKeepSidesRatio;
resizeSingleNonGenericElement(
element,
transformHandleType,
isResizeCenterPoint,
keepSquareAspectRatio,
pointerX,
pointerY,
);
setTransformHandle(
normalizeTransformHandleType(element, transformHandleType),
);
if (element.width < 0) {
mutateElement(element, { width: -element.width });
}
if (element.height < 0) {
mutateElement(element, { height: -element.height });
}
}
</s> add resizeSingleElement(
pointerDownState.originalElements.get(element.id) as typeof element,
shouldKeepSidesRatio,
element,
transformHandleType,
isResizeCenterPoint,
pointerX,
pointerY,
);
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep keep add keep keep keep keep keep keep
|
<mask> updateBoundElements(element, {
<mask> newSize: { width: resizedElement.width, height: resizedElement.height },
<mask> });
<mask> }
<mask> };
<mask>
<mask> const resizeMultipleElements = (
<mask> elements: readonly NonDeletedExcalidrawElement[],
<mask> transformHandleType: "nw" | "ne" | "sw" | "se",
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove const resizedElement = {
width: Math.abs(newWidth),
height: Math.abs(newHeight),
x: newTopLeft[0],
y: newTopLeft[1],
};
updateBoundElements(element, {
newSize: { width: resizedElement.width, height: resizedElement.height },
});
mutateElement(element, resizedElement);
};
const resizeSingleNonGenericElement = (
element: NonDeleted<Exclude<ExcalidrawElement, ExcalidrawGenericElement>>,
transformHandleType: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
isResizeFromCenter: boolean,
keepSquareAspectRatio: boolean,
pointerX: number,
pointerY: number,
) => {
const [x1, y1, x2, y2] = getElementAbsoluteCoords(element);
const cx = (x1 + x2) / 2;
const cy = (y1 + y2) / 2;
// rotation pointer with reverse angle
const [rotatedX, rotatedY] = rotate(
pointerX,
pointerY,
cx,
cy,
-element.angle,
</s> add // Readjust points for linear elements
const rescaledPoints = rescalePointsInElement(
stateAtResizeStart,
eleNewWidth,
eleNewHeight, </s> remove mutateElement(element, {
width: nextWidth,
height: nextHeight,
x: nextElementX,
y: nextElementY,
...rescaledPoints,
</s> add updateBoundElements(element, {
newSize: { width: resizedElement.width, height: resizedElement.height }, </s> remove export const getFlipAdjustment = (
side: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
nextWidth: number,
nextHeight: number,
nextX1: number,
nextY1: number,
nextX2: number,
nextY2: number,
finalX1: number,
finalY1: number,
finalX2: number,
finalY2: number,
needsRotation: boolean,
angle: number,
): [number, number] => {
const cos = Math.cos(angle);
const sin = Math.sin(angle);
let flipDiffX = 0;
let flipDiffY = 0;
if (nextWidth < 0) {
if (side === "e" || side === "ne" || side === "se") {
if (needsRotation) {
flipDiffX += (finalX2 - nextX1) * cos;
flipDiffY += (finalX2 - nextX1) * sin;
} else {
flipDiffX += finalX2 - nextX1;
}
}
if (side === "w" || side === "nw" || side === "sw") {
if (needsRotation) {
flipDiffX += (finalX1 - nextX2) * cos;
flipDiffY += (finalX1 - nextX2) * sin;
} else {
flipDiffX += finalX1 - nextX2;
}
}
}
if (nextHeight < 0) {
if (side === "s" || side === "se" || side === "sw") {
if (needsRotation) {
flipDiffY += (finalY2 - nextY1) * cos;
flipDiffX += (finalY2 - nextY1) * -sin;
} else {
flipDiffY += finalY2 - nextY1;
}
}
if (side === "n" || side === "ne" || side === "nw") {
if (needsRotation) {
flipDiffY += (finalY1 - nextY2) * cos;
flipDiffX += (finalY1 - nextY2) * -sin;
} else {
flipDiffY += finalY1 - nextY2;
}
}
}
return [flipDiffX, flipDiffY];
};
</s> add </s> remove setTransformHandle: (nextTransformHandle: MaybeTransformHandleType) => void,
</s> add </s> remove let scaleX = 1;
let scaleY = 1;
if (
transformHandleType === "e" ||
transformHandleType === "ne" ||
transformHandleType === "se"
) {
scaleX = (rotatedX - x1) / (x2 - x1);
}
if (
transformHandleType === "s" ||
transformHandleType === "sw" ||
transformHandleType === "se"
) {
scaleY = (rotatedY - y1) / (y2 - y1);
}
if (
transformHandleType === "w" ||
transformHandleType === "nw" ||
transformHandleType === "sw"
) {
scaleX = (x2 - rotatedX) / (x2 - x1);
}
if (
transformHandleType === "n" ||
transformHandleType === "nw" ||
transformHandleType === "ne"
) {
scaleY = (y2 - rotatedY) / (y2 - y1);
}
let nextWidth = element.width * scaleX;
let nextHeight = element.height * scaleY;
if (keepSquareAspectRatio) {
nextWidth = nextHeight = Math.max(nextWidth, nextHeight);
}
const [nextX1, nextY1, nextX2, nextY2] = getResizedElementAbsoluteCoords(
element,
nextWidth,
nextHeight,
);
const deltaX1 = (x1 - nextX1) / 2;
const deltaY1 = (y1 - nextY1) / 2;
const deltaX2 = (x2 - nextX2) / 2;
const deltaY2 = (y2 - nextY2) / 2;
const rescaledPoints = rescalePointsInElement(element, nextWidth, nextHeight);
updateBoundElements(element, {
newSize: { width: nextWidth, height: nextHeight },
});
const [finalX1, finalY1, finalX2, finalY2] = getResizedElementAbsoluteCoords(
{
...element,
...rescaledPoints,
},
Math.abs(nextWidth),
Math.abs(nextHeight),
);
const [flipDiffX, flipDiffY] = getFlipAdjustment(
transformHandleType,
nextWidth,
nextHeight,
nextX1,
nextY1,
nextX2,
nextY2,
finalX1,
finalY1,
finalX2,
finalY2,
isLinearElement(element),
element.angle,
);
const [nextElementX, nextElementY] = adjustXYWithRotation(
getSidesForTransformHandle(transformHandleType, isResizeFromCenter),
element.x - flipDiffX,
element.y - flipDiffY,
element.angle,
deltaX1,
deltaY1,
deltaX2,
deltaY2,
);
</s> add const resizedElement = {
width: Math.abs(eleNewWidth),
height: Math.abs(eleNewHeight),
x: newOrigin[0],
y: newOrigin[1],
...rescaledPoints,
}; </s> remove ${"ne"} | ${[10, 55]} | ${[110, 45]} | ${[elemData.x, 55]}
</s> add ${"ne"} | ${[5, 55]} | ${[105, 45]} | ${[elemData.x, 55]}
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeElements.ts
|
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace
|
<mask> }
<mask>
<mask> return cursor ? `${cursor}-resize` : "";
<mask> };
<mask>
<mask> export const normalizeTransformHandleType = (
<mask> element: ExcalidrawElement,
<mask> transformHandleType: TransformHandleType,
<mask> ): TransformHandleType => {
<mask> if (element.width >= 0 && element.height >= 0) {
<mask> return transformHandleType;
<mask> }
<mask>
<mask> if (element.width < 0 && element.height < 0) {
<mask> switch (transformHandleType) {
<mask> case "nw":
<mask> return "se";
<mask> case "ne":
<mask> return "sw";
<mask> case "se":
<mask> return "nw";
<mask> case "sw":
<mask> return "ne";
<mask> }
<mask> } else if (element.width < 0) {
<mask> switch (transformHandleType) {
<mask> case "nw":
<mask> return "ne";
<mask> case "ne":
<mask> return "nw";
<mask> case "se":
<mask> return "sw";
<mask> case "sw":
<mask> return "se";
<mask> case "e":
<mask> return "w";
<mask> case "w":
<mask> return "e";
<mask> }
<mask> } else {
<mask> switch (transformHandleType) {
<mask> case "nw":
<mask> return "sw";
<mask> case "ne":
<mask> return "se";
<mask> case "se":
<mask> return "ne";
<mask> case "sw":
<mask> return "nw";
<mask> case "n":
<mask> return "s";
<mask> case "s":
<mask> return "n";
<mask> }
<mask> }
<mask>
<mask> return transformHandleType;
<mask> };
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove export const getFlipAdjustment = (
side: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
nextWidth: number,
nextHeight: number,
nextX1: number,
nextY1: number,
nextX2: number,
nextY2: number,
finalX1: number,
finalY1: number,
finalX2: number,
finalY2: number,
needsRotation: boolean,
angle: number,
): [number, number] => {
const cos = Math.cos(angle);
const sin = Math.sin(angle);
let flipDiffX = 0;
let flipDiffY = 0;
if (nextWidth < 0) {
if (side === "e" || side === "ne" || side === "se") {
if (needsRotation) {
flipDiffX += (finalX2 - nextX1) * cos;
flipDiffY += (finalX2 - nextX1) * sin;
} else {
flipDiffX += finalX2 - nextX1;
}
}
if (side === "w" || side === "nw" || side === "sw") {
if (needsRotation) {
flipDiffX += (finalX1 - nextX2) * cos;
flipDiffY += (finalX1 - nextX2) * sin;
} else {
flipDiffX += finalX1 - nextX2;
}
}
}
if (nextHeight < 0) {
if (side === "s" || side === "se" || side === "sw") {
if (needsRotation) {
flipDiffY += (finalY2 - nextY1) * cos;
flipDiffX += (finalY2 - nextY1) * -sin;
} else {
flipDiffY += finalY2 - nextY1;
}
}
if (side === "n" || side === "ne" || side === "nw") {
if (needsRotation) {
flipDiffY += (finalY1 - nextY2) * cos;
flipDiffX += (finalY1 - nextY2) * -sin;
} else {
flipDiffY += finalY1 - nextY2;
}
}
}
return [flipDiffX, flipDiffY];
};
</s> add </s> remove if (isGenericElement(element)) {
resizeSingleGenericElement(
pointerDownState.originalElements.get(element.id) as typeof element,
shouldKeepSidesRatio,
element,
transformHandleType,
isResizeCenterPoint,
pointerX,
pointerY,
);
} else {
const keepSquareAspectRatio = shouldKeepSidesRatio;
resizeSingleNonGenericElement(
element,
transformHandleType,
isResizeCenterPoint,
keepSquareAspectRatio,
pointerX,
pointerY,
);
setTransformHandle(
normalizeTransformHandleType(element, transformHandleType),
);
if (element.width < 0) {
mutateElement(element, { width: -element.width });
}
if (element.height < 0) {
mutateElement(element, { height: -element.height });
}
}
</s> add resizeSingleElement(
pointerDownState.originalElements.get(element.id) as typeof element,
shouldKeepSidesRatio,
element,
transformHandleType,
isResizeCenterPoint,
pointerX,
pointerY,
); </s> remove if (newWidth < 0) {
</s> add if (eleNewWidth < 0) { </s> remove if (newHeight < 0) {
</s> add if (eleNewHeight < 0) { </s> remove mutateElement(element, {
width: nextWidth,
height: nextHeight,
x: nextElementX,
y: nextElementY,
...rescaledPoints,
</s> add updateBoundElements(element, {
newSize: { width: resizedElement.width, height: resizedElement.height }, </s> remove newTopLeft[1] -= Math.abs(newHeight);
</s> add newTopLeft[1] -= Math.abs(newBoundsHeight);
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/element/resizeTest.ts
|
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
|
<mask> }
<mask> return [x, y];
<mask> };
<mask>
<mask> export const getFlipAdjustment = (
<mask> side: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
<mask> nextWidth: number,
<mask> nextHeight: number,
<mask> nextX1: number,
<mask> nextY1: number,
<mask> nextX2: number,
<mask> nextY2: number,
<mask> finalX1: number,
<mask> finalY1: number,
<mask> finalX2: number,
<mask> finalY2: number,
<mask> needsRotation: boolean,
<mask> angle: number,
<mask> ): [number, number] => {
<mask> const cos = Math.cos(angle);
<mask> const sin = Math.sin(angle);
<mask> let flipDiffX = 0;
<mask> let flipDiffY = 0;
<mask> if (nextWidth < 0) {
<mask> if (side === "e" || side === "ne" || side === "se") {
<mask> if (needsRotation) {
<mask> flipDiffX += (finalX2 - nextX1) * cos;
<mask> flipDiffY += (finalX2 - nextX1) * sin;
<mask> } else {
<mask> flipDiffX += finalX2 - nextX1;
<mask> }
<mask> }
<mask> if (side === "w" || side === "nw" || side === "sw") {
<mask> if (needsRotation) {
<mask> flipDiffX += (finalX1 - nextX2) * cos;
<mask> flipDiffY += (finalX1 - nextX2) * sin;
<mask> } else {
<mask> flipDiffX += finalX1 - nextX2;
<mask> }
<mask> }
<mask> }
<mask> if (nextHeight < 0) {
<mask> if (side === "s" || side === "se" || side === "sw") {
<mask> if (needsRotation) {
<mask> flipDiffY += (finalY2 - nextY1) * cos;
<mask> flipDiffX += (finalY2 - nextY1) * -sin;
<mask> } else {
<mask> flipDiffY += finalY2 - nextY1;
<mask> }
<mask> }
<mask> if (side === "n" || side === "ne" || side === "nw") {
<mask> if (needsRotation) {
<mask> flipDiffY += (finalY1 - nextY2) * cos;
<mask> flipDiffX += (finalY1 - nextY2) * -sin;
<mask> } else {
<mask> flipDiffY += finalY1 - nextY2;
<mask> }
<mask> }
<mask> }
<mask> return [flipDiffX, flipDiffY];
<mask> };
<mask>
<mask> export const getPointOnAPath = (point: Point, path: Point[]) => {
<mask> const [px, py] = point;
<mask> const [start, ...other] = path;
<mask> let [lastX, lastY] = start;
<mask> let kLine: number = 0;
</s> improvement: Enhance resize for non generic elements (#2720) </s> remove let scaleX = 1;
let scaleY = 1;
if (
transformHandleType === "e" ||
transformHandleType === "ne" ||
transformHandleType === "se"
) {
scaleX = (rotatedX - x1) / (x2 - x1);
}
if (
transformHandleType === "s" ||
transformHandleType === "sw" ||
transformHandleType === "se"
) {
scaleY = (rotatedY - y1) / (y2 - y1);
}
if (
transformHandleType === "w" ||
transformHandleType === "nw" ||
transformHandleType === "sw"
) {
scaleX = (x2 - rotatedX) / (x2 - x1);
}
if (
transformHandleType === "n" ||
transformHandleType === "nw" ||
transformHandleType === "ne"
) {
scaleY = (y2 - rotatedY) / (y2 - y1);
}
let nextWidth = element.width * scaleX;
let nextHeight = element.height * scaleY;
if (keepSquareAspectRatio) {
nextWidth = nextHeight = Math.max(nextWidth, nextHeight);
}
const [nextX1, nextY1, nextX2, nextY2] = getResizedElementAbsoluteCoords(
element,
nextWidth,
nextHeight,
);
const deltaX1 = (x1 - nextX1) / 2;
const deltaY1 = (y1 - nextY1) / 2;
const deltaX2 = (x2 - nextX2) / 2;
const deltaY2 = (y2 - nextY2) / 2;
const rescaledPoints = rescalePointsInElement(element, nextWidth, nextHeight);
updateBoundElements(element, {
newSize: { width: nextWidth, height: nextHeight },
});
const [finalX1, finalY1, finalX2, finalY2] = getResizedElementAbsoluteCoords(
{
...element,
...rescaledPoints,
},
Math.abs(nextWidth),
Math.abs(nextHeight),
);
const [flipDiffX, flipDiffY] = getFlipAdjustment(
transformHandleType,
nextWidth,
nextHeight,
nextX1,
nextY1,
nextX2,
nextY2,
finalX1,
finalY1,
finalX2,
finalY2,
isLinearElement(element),
element.angle,
);
const [nextElementX, nextElementY] = adjustXYWithRotation(
getSidesForTransformHandle(transformHandleType, isResizeFromCenter),
element.x - flipDiffX,
element.y - flipDiffY,
element.angle,
deltaX1,
deltaY1,
deltaX2,
deltaY2,
);
</s> add const resizedElement = {
width: Math.abs(eleNewWidth),
height: Math.abs(eleNewHeight),
x: newOrigin[0],
y: newOrigin[1],
...rescaledPoints,
}; </s> remove const resizedElement = {
width: Math.abs(newWidth),
height: Math.abs(newHeight),
x: newTopLeft[0],
y: newTopLeft[1],
};
updateBoundElements(element, {
newSize: { width: resizedElement.width, height: resizedElement.height },
});
mutateElement(element, resizedElement);
};
const resizeSingleNonGenericElement = (
element: NonDeleted<Exclude<ExcalidrawElement, ExcalidrawGenericElement>>,
transformHandleType: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
isResizeFromCenter: boolean,
keepSquareAspectRatio: boolean,
pointerX: number,
pointerY: number,
) => {
const [x1, y1, x2, y2] = getElementAbsoluteCoords(element);
const cx = (x1 + x2) / 2;
const cy = (y1 + y2) / 2;
// rotation pointer with reverse angle
const [rotatedX, rotatedY] = rotate(
pointerX,
pointerY,
cx,
cy,
-element.angle,
</s> add // Readjust points for linear elements
const rescaledPoints = rescalePointsInElement(
stateAtResizeStart,
eleNewWidth,
eleNewHeight, </s> remove newHeight *= widthRatio;
newWidth *= heightRatio;
</s> add eleNewHeight *= widthRatio;
eleNewWidth *= heightRatio; </s> remove newWidth = stateAtResizeStart.width * ratio * Math.sign(newWidth);
newHeight = stateAtResizeStart.height * ratio * Math.sign(newHeight);
</s> add eleNewWidth = eleInitialWidth * ratio * Math.sign(eleNewWidth);
eleNewHeight = eleInitialHeight * ratio * Math.sign(eleNewHeight); </s> remove const bottomLeft = [
stateAtResizeStart.x,
stateAtResizeStart.y + stateAtResizeStart.height,
];
newTopLeft = [bottomLeft[0], bottomLeft[1] - Math.abs(newHeight)];
</s> add const bottomLeft = [startTopLeft[0], startBottomRight[1]];
newTopLeft = [bottomLeft[0], bottomLeft[1] - Math.abs(newBoundsHeight)]; </s> remove newTopLeft[1] += Math.abs(newHeight);
</s> add newTopLeft[1] += Math.abs(newBoundsHeight);
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/math.ts
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> ${"n"} | ${[_, -100]} | ${[100, 200]} | ${[elemData.x, -100]}
<mask> ${"s"} | ${[_, 39]} | ${[100, 139]} | ${[elemData.x, elemData.x]}
<mask> ${"e"} | ${[-20, _]} | ${[80, 100]} | ${[elemData.x, elemData.y]}
<mask> ${"w"} | ${[-20, _]} | ${[120, 100]} | ${[-20, elemData.y]}
<mask> ${"ne"} | ${[10, 55]} | ${[110, 45]} | ${[elemData.x, 55]}
<mask> ${"se"} | ${[-30, -10]} | ${[70, 90]} | ${[elemData.x, elemData.y]}
<mask> ${"nw"} | ${[-300, -200]} | ${[400, 300]} | ${[-300, -200]}
<mask> ${"sw"} | ${[40, -20]} | ${[60, 80]} | ${[40, 0]}
<mask> `("resizes with handle $handle", ({ handle, move, dimensions, topLeft }) => {
<mask> render(<App />);
</s> improvement: Enhance resize for non generic elements (#2720) </s> add mutateElement(element, resizedElement); </s> remove const resizedElement = {
width: Math.abs(newWidth),
height: Math.abs(newHeight),
x: newTopLeft[0],
y: newTopLeft[1],
};
updateBoundElements(element, {
newSize: { width: resizedElement.width, height: resizedElement.height },
});
mutateElement(element, resizedElement);
};
const resizeSingleNonGenericElement = (
element: NonDeleted<Exclude<ExcalidrawElement, ExcalidrawGenericElement>>,
transformHandleType: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
isResizeFromCenter: boolean,
keepSquareAspectRatio: boolean,
pointerX: number,
pointerY: number,
) => {
const [x1, y1, x2, y2] = getElementAbsoluteCoords(element);
const cx = (x1 + x2) / 2;
const cy = (y1 + y2) / 2;
// rotation pointer with reverse angle
const [rotatedX, rotatedY] = rotate(
pointerX,
pointerY,
cx,
cy,
-element.angle,
</s> add // Readjust points for linear elements
const rescaledPoints = rescalePointsInElement(
stateAtResizeStart,
eleNewWidth,
eleNewHeight, </s> remove export const getFlipAdjustment = (
side: "n" | "s" | "w" | "e" | "nw" | "ne" | "sw" | "se",
nextWidth: number,
nextHeight: number,
nextX1: number,
nextY1: number,
nextX2: number,
nextY2: number,
finalX1: number,
finalY1: number,
finalX2: number,
finalY2: number,
needsRotation: boolean,
angle: number,
): [number, number] => {
const cos = Math.cos(angle);
const sin = Math.sin(angle);
let flipDiffX = 0;
let flipDiffY = 0;
if (nextWidth < 0) {
if (side === "e" || side === "ne" || side === "se") {
if (needsRotation) {
flipDiffX += (finalX2 - nextX1) * cos;
flipDiffY += (finalX2 - nextX1) * sin;
} else {
flipDiffX += finalX2 - nextX1;
}
}
if (side === "w" || side === "nw" || side === "sw") {
if (needsRotation) {
flipDiffX += (finalX1 - nextX2) * cos;
flipDiffY += (finalX1 - nextX2) * sin;
} else {
flipDiffX += finalX1 - nextX2;
}
}
}
if (nextHeight < 0) {
if (side === "s" || side === "se" || side === "sw") {
if (needsRotation) {
flipDiffY += (finalY2 - nextY1) * cos;
flipDiffX += (finalY2 - nextY1) * -sin;
} else {
flipDiffY += finalY2 - nextY1;
}
}
if (side === "n" || side === "ne" || side === "nw") {
if (needsRotation) {
flipDiffY += (finalY1 - nextY2) * cos;
flipDiffX += (finalY1 - nextY2) * -sin;
} else {
flipDiffY += finalY1 - nextY2;
}
}
}
return [flipDiffX, flipDiffY];
};
</s> add </s> remove setTransformHandle: (nextTransformHandle: MaybeTransformHandleType) => void,
</s> add </s> remove newTopLeft[0] = startCenter[0] - newWidth / 2;
</s> add newTopLeft[0] = startCenter[0] - newBoundsWidth / 2; </s> remove const topRight = [
stateAtResizeStart.x + stateAtResizeStart.width,
stateAtResizeStart.y,
];
newTopLeft = [topRight[0] - Math.abs(newWidth), topRight[1]];
</s> add const topRight = [startBottomRight[0], startTopLeft[1]];
newTopLeft = [topRight[0] - Math.abs(newBoundsWidth), topRight[1]];
|
https://github.com/excalidraw/excalidraw/commit/e26f374ca6175d70d182e9353dae209b71f28e12
|
src/tests/resize.test.tsx
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "export": "Exportar",
<mask> "exportToPng": "Exportar a PNG",
<mask> "exportToSvg": "Exportar a SVG",
<mask> "copyToClipboard": "Copiar al portapapeles",
<mask> "copyPngToClipboard": "Copy PNG to clipboard",
<mask> "save": "Guardar",
<mask> "load": "Cargar",
<mask> "getShareableLink": "Obtener enlace para compartir",
<mask> "close": "Cerrar",
<mask> "selectLanguage": "Seleccionar idioma",
</s> New Crowdin translations (Greek) (#1118) </s> remove "copyPngToClipboard": "Copy PNG to clipboard",
</s> add "copyPngToClipboard": "", </s> remove "copyPngToClipboard": "Copy PNG to clipboard",
</s> add "copyPngToClipboard": "", </s> remove "createRoom": "Share a live-collaboration session",
"duplicateSelection": "Duplicate selected elements"
</s> add "createRoom": "",
"duplicateSelection": "" </s> remove "desc_exitSession": "Stopping the session will disconnect your from the room, but you'll be able to continue working with the scene, locally. Note that this won't affect other people, and they'll still be able to collaborate on their version."
</s> add "desc_exitSession": "" </s> remove "desc_intro": "You can invite people to your current scene to collaborate with you.",
"desc_privacy": "Don't worry, the session uses end-to-end encryption, so whatever you draw will stay private. Not even our server will be able to see what you come up with.",
"button_startSession": "Start session",
"button_stopSession": "Stop session",
"desc_inProgressIntro": "Live-collaboration session is now in progress.",
"desc_persistenceWarning": "Note that the scene data is shared across collaborators in a P2P fashion, and not persisted to our server. Thus, if all of you disconnect, you will loose the data unless you export it to a file or a shareable link.",
"desc_shareLink": "Share this link with anyone you want to collaborate with:",
"desc_exitSession": "Stopping the session will disconnect your from the room, but you'll be able to continue working with the scene, locally. Note that this won't affect other people, and they'll still be able to collaborate on their version."
</s> add "desc_intro": "",
"desc_privacy": "",
"button_startSession": "",
"button_stopSession": "",
"desc_inProgressIntro": "",
"desc_persistenceWarning": "",
"desc_shareLink": "",
"desc_exitSession": "" </s> remove "copyAsPng": "Copy to clipboard as PNG",
</s> add "copyAsPng": "",
|
https://github.com/excalidraw/excalidraw/commit/e2e4f3c805837d27b7ab4aa9582dbc457b83dce6
|
src/locales/es-ES.json
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "labels": {
<mask> "paste": "Tempel",
<mask> "selectAll": "Pilih Semua",
<mask> "copy": "Salin",
<mask> "copyAsPng": "Copy to clipboard as PNG",
<mask> "bringForward": "Memajukan",
<mask> "sendToBack": "Bawa ke Belakang",
<mask> "bringToFront": "Bawa ke Depan",
<mask> "sendBackward": "Mundurkan",
<mask> "delete": "Hapus",
</s> New Crowdin translations (Greek) (#1118) </s> remove "copyPngToClipboard": "Copy PNG to clipboard",
</s> add "copyPngToClipboard": "", </s> remove "createRoom": "Share a live-collaboration session",
"duplicateSelection": "Duplicate selected elements"
</s> add "createRoom": "",
"duplicateSelection": "" </s> remove "decryptFailed": "Couldn't decrypt data.",
</s> add "decryptFailed": "", </s> remove "copyPngToClipboard": "Copy PNG to clipboard",
</s> add "copyPngToClipboard": "", </s> remove "copyPngToClipboard": "Copy PNG to clipboard",
</s> add "copyPngToClipboard": "", </s> remove "linearElementMulti": "Click on last point or press Escape or Enter to finish",
</s> add "linearElementMulti": "",
|
https://github.com/excalidraw/excalidraw/commit/e2e4f3c805837d27b7ab4aa9582dbc457b83dce6
|
src/locales/id-ID.json
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> "canvasBackground": "Latar Kanvas",
<mask> "drawingCanvas": "Kanvas",
<mask> "layers": "Lapisan",
<mask> "language": "Bahasa",
<mask> "createRoom": "Share a live-collaboration session",
<mask> "duplicateSelection": "Duplicate selected elements"
<mask> },
<mask> "buttons": {
<mask> "clearReset": "Setel Ulang Kanvas",
<mask> "export": "Ekspor",
<mask> "exportToPng": "Ekspor ke PNG",
</s> New Crowdin translations (Greek) (#1118) </s> remove "copyPngToClipboard": "Copy PNG to clipboard",
</s> add "copyPngToClipboard": "", </s> remove "desc_intro": "You can invite people to your current scene to collaborate with you.",
"desc_privacy": "Don't worry, the session uses end-to-end encryption, so whatever you draw will stay private. Not even our server will be able to see what you come up with.",
"button_startSession": "Start session",
"button_stopSession": "Stop session",
"desc_inProgressIntro": "Live-collaboration session is now in progress.",
"desc_persistenceWarning": "Note that the scene data is shared across collaborators in a P2P fashion, and not persisted to our server. Thus, if all of you disconnect, you will loose the data unless you export it to a file or a shareable link.",
"desc_shareLink": "Share this link with anyone you want to collaborate with:",
"desc_exitSession": "Stopping the session will disconnect your from the room, but you'll be able to continue working with the scene, locally. Note that this won't affect other people, and they'll still be able to collaborate on their version."
</s> add "desc_intro": "",
"desc_privacy": "",
"button_startSession": "",
"button_stopSession": "",
"desc_inProgressIntro": "",
"desc_persistenceWarning": "",
"desc_shareLink": "",
"desc_exitSession": "" </s> remove "roomDialog": "Start live collaboration",
"createNewRoom": "Create new room"
</s> add "roomDialog": "",
"createNewRoom": "" </s> remove "copyPngToClipboard": "Copy PNG to clipboard",
</s> add "copyPngToClipboard": "", </s> remove "copyAsPng": "Copy to clipboard as PNG",
</s> add "copyAsPng": "", </s> remove "copyPngToClipboard": "Copy PNG to clipboard",
</s> add "copyPngToClipboard": "",
|
https://github.com/excalidraw/excalidraw/commit/e2e4f3c805837d27b7ab4aa9582dbc457b83dce6
|
src/locales/id-ID.json
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "export": "Ekspor",
<mask> "exportToPng": "Ekspor ke PNG",
<mask> "exportToSvg": "Ekspor ke SVG",
<mask> "copyToClipboard": "Salin ke Papan Klip",
<mask> "copyPngToClipboard": "Copy PNG to clipboard",
<mask> "save": "Simpan",
<mask> "load": "Muat",
<mask> "getShareableLink": "Buat Tautan yang Bisa Dibagian",
<mask> "close": "Tutup",
<mask> "selectLanguage": "Pilih Bahasa",
</s> New Crowdin translations (Greek) (#1118) </s> remove "copyPngToClipboard": "Copy PNG to clipboard",
</s> add "copyPngToClipboard": "", </s> remove "copyPngToClipboard": "Copy PNG to clipboard",
</s> add "copyPngToClipboard": "", </s> remove "createRoom": "Share a live-collaboration session",
"duplicateSelection": "Duplicate selected elements"
</s> add "createRoom": "",
"duplicateSelection": "" </s> remove "copyAsPng": "Copy to clipboard as PNG",
</s> add "copyAsPng": "", </s> remove "decryptFailed": "Couldn't decrypt data.",
</s> add "decryptFailed": "", </s> remove "roomDialog": "Start live collaboration",
"createNewRoom": "Create new room"
</s> add "roomDialog": "",
"createNewRoom": ""
|
https://github.com/excalidraw/excalidraw/commit/e2e4f3c805837d27b7ab4aa9582dbc457b83dce6
|
src/locales/id-ID.json
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> "done": "Selesai",
<mask> "edit": "Sunting",
<mask> "undo": "Urungkan",
<mask> "redo": "Mengulang",
<mask> "roomDialog": "Start live collaboration",
<mask> "createNewRoom": "Create new room"
<mask> },
<mask> "alerts": {
<mask> "clearReset": "Ini akan menghapus semua yang ada dikanvas. Apakah kamu yakin ?",
<mask> "couldNotCreateShareableLink": "Tidak bisa membuat tautan yang bisa dibagikan",
<mask> "importBackendFailed": "Gagal mengimpor dari backend",
</s> New Crowdin translations (Greek) (#1118) </s> remove "decryptFailed": "Couldn't decrypt data.",
</s> add "decryptFailed": "", </s> remove "createRoom": "Share a live-collaboration session",
"duplicateSelection": "Duplicate selected elements"
</s> add "createRoom": "",
"duplicateSelection": "" </s> remove "copyPngToClipboard": "Copy PNG to clipboard",
</s> add "copyPngToClipboard": "", </s> remove "headingMain_pre": "Encountered an error. Try ",
"headingMain_button": "reloading the page.",
"clearCanvasMessage": "If reloading doesn't work, try ",
"clearCanvasMessage_button": "clearing the canvas.",
"clearCanvasCaveat": " This will result in loss of work ",
"openIssueMessage_pre": "Before doing so, we'd appreciate if you opened an issue on our ",
"openIssueMessage_button": "bug tracker.",
"openIssueMessage_post": " Please include the following error stack trace (and if it's not private, also the scene content):",
"errorStack": "Error stack trace:",
"errorStack_loading": "Loading data. please wait...",
"sceneContent": "Scene content:"
</s> add "headingMain_pre": "",
"headingMain_button": "",
"clearCanvasMessage": "",
"clearCanvasMessage_button": "",
"clearCanvasCaveat": "",
"openIssueMessage_pre": "",
"openIssueMessage_button": "",
"openIssueMessage_post": "",
"errorStack": "",
"errorStack_loading": "",
"sceneContent": "" </s> remove "desc_intro": "You can invite people to your current scene to collaborate with you.",
"desc_privacy": "Don't worry, the session uses end-to-end encryption, so whatever you draw will stay private. Not even our server will be able to see what you come up with.",
"button_startSession": "Start session",
"button_stopSession": "Stop session",
"desc_inProgressIntro": "Live-collaboration session is now in progress.",
"desc_persistenceWarning": "Note that the scene data is shared across collaborators in a P2P fashion, and not persisted to our server. Thus, if all of you disconnect, you will loose the data unless you export it to a file or a shareable link.",
"desc_shareLink": "Share this link with anyone you want to collaborate with:",
"desc_exitSession": "Stopping the session will disconnect your from the room, but you'll be able to continue working with the scene, locally. Note that this won't affect other people, and they'll still be able to collaborate on their version."
</s> add "desc_intro": "",
"desc_privacy": "",
"button_startSession": "",
"button_stopSession": "",
"desc_inProgressIntro": "",
"desc_persistenceWarning": "",
"desc_shareLink": "",
"desc_exitSession": "" </s> remove "linearElementMulti": "Click on last point or press Escape or Enter to finish",
</s> add "linearElementMulti": "",
|
https://github.com/excalidraw/excalidraw/commit/e2e4f3c805837d27b7ab4aa9582dbc457b83dce6
|
src/locales/id-ID.json
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "couldNotCreateShareableLink": "Tidak bisa membuat tautan yang bisa dibagikan",
<mask> "importBackendFailed": "Gagal mengimpor dari backend",
<mask> "cannotExportEmptyCanvas": "Tidak bisa mengekspor kanvas kosong",
<mask> "couldNotCopyToClipboard": "Tidak bisa menyalin ke papan klip. Coba gunakan Browser Chrome",
<mask> "decryptFailed": "Couldn't decrypt data.",
<mask> "uploadedSecurly": "Pengunggahan ini telah diamankan menggunakan enkripsi end-to-end, artinya server Excalidraw dan pihak ketiga tidak data membaca nya"
<mask> },
<mask> "toolBar": {
<mask> "selection": "Pilihan",
<mask> "rectangle": "Persegi",
</s> New Crowdin translations (Greek) (#1118) </s> remove "roomDialog": "Start live collaboration",
"createNewRoom": "Create new room"
</s> add "roomDialog": "",
"createNewRoom": "" </s> remove "copyPngToClipboard": "Copy PNG to clipboard",
</s> add "copyPngToClipboard": "", </s> remove "desc_intro": "You can invite people to your current scene to collaborate with you.",
"desc_privacy": "Don't worry, the session uses end-to-end encryption, so whatever you draw will stay private. Not even our server will be able to see what you come up with.",
"button_startSession": "Start session",
"button_stopSession": "Stop session",
"desc_inProgressIntro": "Live-collaboration session is now in progress.",
"desc_persistenceWarning": "Note that the scene data is shared across collaborators in a P2P fashion, and not persisted to our server. Thus, if all of you disconnect, you will loose the data unless you export it to a file or a shareable link.",
"desc_shareLink": "Share this link with anyone you want to collaborate with:",
"desc_exitSession": "Stopping the session will disconnect your from the room, but you'll be able to continue working with the scene, locally. Note that this won't affect other people, and they'll still be able to collaborate on their version."
</s> add "desc_intro": "",
"desc_privacy": "",
"button_startSession": "",
"button_stopSession": "",
"desc_inProgressIntro": "",
"desc_persistenceWarning": "",
"desc_shareLink": "",
"desc_exitSession": "" </s> remove "createRoom": "Share a live-collaboration session",
"duplicateSelection": "Duplicate selected elements"
</s> add "createRoom": "",
"duplicateSelection": "" </s> remove "copyAsPng": "Copy to clipboard as PNG",
</s> add "copyAsPng": "", </s> remove "headingMain_pre": "Encountered an error. Try ",
"headingMain_button": "reloading the page.",
"clearCanvasMessage": "If reloading doesn't work, try ",
"clearCanvasMessage_button": "clearing the canvas.",
"clearCanvasCaveat": " This will result in loss of work ",
"openIssueMessage_pre": "Before doing so, we'd appreciate if you opened an issue on our ",
"openIssueMessage_button": "bug tracker.",
"openIssueMessage_post": " Please include the following error stack trace (and if it's not private, also the scene content):",
"errorStack": "Error stack trace:",
"errorStack_loading": "Loading data. please wait...",
"sceneContent": "Scene content:"
</s> add "headingMain_pre": "",
"headingMain_button": "",
"clearCanvasMessage": "",
"clearCanvasMessage_button": "",
"clearCanvasCaveat": "",
"openIssueMessage_pre": "",
"openIssueMessage_button": "",
"openIssueMessage_post": "",
"errorStack": "",
"errorStack_loading": "",
"sceneContent": ""
|
https://github.com/excalidraw/excalidraw/commit/e2e4f3c805837d27b7ab4aa9582dbc457b83dce6
|
src/locales/id-ID.json
|
keep keep keep replace keep keep keep replace replace replace replace replace replace replace replace replace replace replace
|
<mask> },
<mask> "hints": {
<mask> "linearElement": "Klik untuk memulai banyak poin, seret untuk satu baris",
<mask> "linearElementMulti": "Click on last point or press Escape or Enter to finish",
<mask> "resize": "Anda dapat membatasi proporsi dengan menahan SHIFT sambil mengubah ukuran"
<mask> },
<mask> "errorSplash": {
<mask> "headingMain_pre": "Encountered an error. Try ",
<mask> "headingMain_button": "reloading the page.",
<mask> "clearCanvasMessage": "If reloading doesn't work, try ",
<mask> "clearCanvasMessage_button": "clearing the canvas.",
<mask> "clearCanvasCaveat": " This will result in loss of work ",
<mask> "openIssueMessage_pre": "Before doing so, we'd appreciate if you opened an issue on our ",
<mask> "openIssueMessage_button": "bug tracker.",
<mask> "openIssueMessage_post": " Please include the following error stack trace (and if it's not private, also the scene content):",
<mask> "errorStack": "Error stack trace:",
<mask> "errorStack_loading": "Loading data. please wait...",
<mask> "sceneContent": "Scene content:"
</s> New Crowdin translations (Greek) (#1118) </s> remove "desc_intro": "You can invite people to your current scene to collaborate with you.",
"desc_privacy": "Don't worry, the session uses end-to-end encryption, so whatever you draw will stay private. Not even our server will be able to see what you come up with.",
"button_startSession": "Start session",
"button_stopSession": "Stop session",
"desc_inProgressIntro": "Live-collaboration session is now in progress.",
"desc_persistenceWarning": "Note that the scene data is shared across collaborators in a P2P fashion, and not persisted to our server. Thus, if all of you disconnect, you will loose the data unless you export it to a file or a shareable link.",
"desc_shareLink": "Share this link with anyone you want to collaborate with:",
"desc_exitSession": "Stopping the session will disconnect your from the room, but you'll be able to continue working with the scene, locally. Note that this won't affect other people, and they'll still be able to collaborate on their version."
</s> add "desc_intro": "",
"desc_privacy": "",
"button_startSession": "",
"button_stopSession": "",
"desc_inProgressIntro": "",
"desc_persistenceWarning": "",
"desc_shareLink": "",
"desc_exitSession": "" </s> remove "desc_exitSession": "Stopping the session will disconnect your from the room, but you'll be able to continue working with the scene, locally. Note that this won't affect other people, and they'll still be able to collaborate on their version."
</s> add "desc_exitSession": "" </s> remove "createRoom": "Share a live-collaboration session",
"duplicateSelection": "Duplicate selected elements"
</s> add "createRoom": "",
"duplicateSelection": "" </s> remove "roomDialog": "Start live collaboration",
"createNewRoom": "Create new room"
</s> add "roomDialog": "",
"createNewRoom": "" </s> remove "decryptFailed": "Couldn't decrypt data.",
</s> add "decryptFailed": "",
|
https://github.com/excalidraw/excalidraw/commit/e2e4f3c805837d27b7ab4aa9582dbc457b83dce6
|
src/locales/id-ID.json
|
keep keep keep keep replace replace replace replace replace replace replace replace keep keep
|
<mask> "errorStack_loading": "Loading data. please wait...",
<mask> "sceneContent": "Scene content:"
<mask> },
<mask> "roomDialog": {
<mask> "desc_intro": "You can invite people to your current scene to collaborate with you.",
<mask> "desc_privacy": "Don't worry, the session uses end-to-end encryption, so whatever you draw will stay private. Not even our server will be able to see what you come up with.",
<mask> "button_startSession": "Start session",
<mask> "button_stopSession": "Stop session",
<mask> "desc_inProgressIntro": "Live-collaboration session is now in progress.",
<mask> "desc_persistenceWarning": "Note that the scene data is shared across collaborators in a P2P fashion, and not persisted to our server. Thus, if all of you disconnect, you will loose the data unless you export it to a file or a shareable link.",
<mask> "desc_shareLink": "Share this link with anyone you want to collaborate with:",
<mask> "desc_exitSession": "Stopping the session will disconnect your from the room, but you'll be able to continue working with the scene, locally. Note that this won't affect other people, and they'll still be able to collaborate on their version."
<mask> }
<mask> }
</s> New Crowdin translations (Greek) (#1118) </s> remove "desc_exitSession": "Stopping the session will disconnect your from the room, but you'll be able to continue working with the scene, locally. Note that this won't affect other people, and they'll still be able to collaborate on their version."
</s> add "desc_exitSession": "" </s> remove "headingMain_pre": "Encountered an error. Try ",
"headingMain_button": "reloading the page.",
"clearCanvasMessage": "If reloading doesn't work, try ",
"clearCanvasMessage_button": "clearing the canvas.",
"clearCanvasCaveat": " This will result in loss of work ",
"openIssueMessage_pre": "Before doing so, we'd appreciate if you opened an issue on our ",
"openIssueMessage_button": "bug tracker.",
"openIssueMessage_post": " Please include the following error stack trace (and if it's not private, also the scene content):",
"errorStack": "Error stack trace:",
"errorStack_loading": "Loading data. please wait...",
"sceneContent": "Scene content:"
</s> add "headingMain_pre": "",
"headingMain_button": "",
"clearCanvasMessage": "",
"clearCanvasMessage_button": "",
"clearCanvasCaveat": "",
"openIssueMessage_pre": "",
"openIssueMessage_button": "",
"openIssueMessage_post": "",
"errorStack": "",
"errorStack_loading": "",
"sceneContent": "" </s> remove "linearElementMulti": "Click on last point or press Escape or Enter to finish",
</s> add "linearElementMulti": "", </s> remove "createRoom": "Share a live-collaboration session",
"duplicateSelection": "Duplicate selected elements"
</s> add "createRoom": "",
"duplicateSelection": "" </s> remove "copyPngToClipboard": "Copy PNG to clipboard",
</s> add "copyPngToClipboard": "", </s> remove "copyPngToClipboard": "Copy PNG to clipboard",
</s> add "copyPngToClipboard": "",
|
https://github.com/excalidraw/excalidraw/commit/e2e4f3c805837d27b7ab4aa9582dbc457b83dce6
|
src/locales/id-ID.json
|
keep keep keep keep replace keep keep
|
<mask> "button_stopSession": "Stopp sesjon",
<mask> "desc_inProgressIntro": "Live-collaboration session is now in progress.",
<mask> "desc_persistenceWarning": "Note that the scene data is shared across collaborators in a P2P fashion, and not persisted to our server. Thus, if all of you disconnect, you will loose the data unless you export it to a file or a shareable link.",
<mask> "desc_shareLink": "Del denne linken med de du vil samarbeide med:",
<mask> "desc_exitSession": "Stopping the session will disconnect your from the room, but you'll be able to continue working with the scene, locally. Note that this won't affect other people, and they'll still be able to collaborate on their version."
<mask> }
<mask> }
</s> New Crowdin translations (Greek) (#1118) </s> remove "desc_intro": "You can invite people to your current scene to collaborate with you.",
"desc_privacy": "Don't worry, the session uses end-to-end encryption, so whatever you draw will stay private. Not even our server will be able to see what you come up with.",
"button_startSession": "Start session",
"button_stopSession": "Stop session",
"desc_inProgressIntro": "Live-collaboration session is now in progress.",
"desc_persistenceWarning": "Note that the scene data is shared across collaborators in a P2P fashion, and not persisted to our server. Thus, if all of you disconnect, you will loose the data unless you export it to a file or a shareable link.",
"desc_shareLink": "Share this link with anyone you want to collaborate with:",
"desc_exitSession": "Stopping the session will disconnect your from the room, but you'll be able to continue working with the scene, locally. Note that this won't affect other people, and they'll still be able to collaborate on their version."
</s> add "desc_intro": "",
"desc_privacy": "",
"button_startSession": "",
"button_stopSession": "",
"desc_inProgressIntro": "",
"desc_persistenceWarning": "",
"desc_shareLink": "",
"desc_exitSession": "" </s> remove "headingMain_pre": "Encountered an error. Try ",
"headingMain_button": "reloading the page.",
"clearCanvasMessage": "If reloading doesn't work, try ",
"clearCanvasMessage_button": "clearing the canvas.",
"clearCanvasCaveat": " This will result in loss of work ",
"openIssueMessage_pre": "Before doing so, we'd appreciate if you opened an issue on our ",
"openIssueMessage_button": "bug tracker.",
"openIssueMessage_post": " Please include the following error stack trace (and if it's not private, also the scene content):",
"errorStack": "Error stack trace:",
"errorStack_loading": "Loading data. please wait...",
"sceneContent": "Scene content:"
</s> add "headingMain_pre": "",
"headingMain_button": "",
"clearCanvasMessage": "",
"clearCanvasMessage_button": "",
"clearCanvasCaveat": "",
"openIssueMessage_pre": "",
"openIssueMessage_button": "",
"openIssueMessage_post": "",
"errorStack": "",
"errorStack_loading": "",
"sceneContent": "" </s> remove "linearElementMulti": "Click on last point or press Escape or Enter to finish",
</s> add "linearElementMulti": "", </s> remove "copyPngToClipboard": "Copy PNG to clipboard",
</s> add "copyPngToClipboard": "", </s> remove "copyPngToClipboard": "Copy PNG to clipboard",
</s> add "copyPngToClipboard": "", </s> remove "copyAsPng": "Copy to clipboard as PNG",
</s> add "copyAsPng": "",
|
https://github.com/excalidraw/excalidraw/commit/e2e4f3c805837d27b7ab4aa9582dbc457b83dce6
|
src/locales/no-NO.json
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "export": "Exportar",
<mask> "exportToPng": "Exportar em PNG",
<mask> "exportToSvg": "Exportar em SVG",
<mask> "copyToClipboard": "Copiar para o clipboard",
<mask> "copyPngToClipboard": "Copy PNG to clipboard",
<mask> "save": "Guardar",
<mask> "load": "Carregar",
<mask> "getShareableLink": "Obter um link de partilha",
<mask> "close": "Fechar",
<mask> "selectLanguage": "Selecionar Idioma",
</s> New Crowdin translations (Greek) (#1118) </s> remove "copyPngToClipboard": "Copy PNG to clipboard",
</s> add "copyPngToClipboard": "", </s> remove "copyPngToClipboard": "Copy PNG to clipboard",
</s> add "copyPngToClipboard": "", </s> remove "desc_exitSession": "Stopping the session will disconnect your from the room, but you'll be able to continue working with the scene, locally. Note that this won't affect other people, and they'll still be able to collaborate on their version."
</s> add "desc_exitSession": "" </s> remove "createRoom": "Share a live-collaboration session",
"duplicateSelection": "Duplicate selected elements"
</s> add "createRoom": "",
"duplicateSelection": "" </s> remove "desc_intro": "You can invite people to your current scene to collaborate with you.",
"desc_privacy": "Don't worry, the session uses end-to-end encryption, so whatever you draw will stay private. Not even our server will be able to see what you come up with.",
"button_startSession": "Start session",
"button_stopSession": "Stop session",
"desc_inProgressIntro": "Live-collaboration session is now in progress.",
"desc_persistenceWarning": "Note that the scene data is shared across collaborators in a P2P fashion, and not persisted to our server. Thus, if all of you disconnect, you will loose the data unless you export it to a file or a shareable link.",
"desc_shareLink": "Share this link with anyone you want to collaborate with:",
"desc_exitSession": "Stopping the session will disconnect your from the room, but you'll be able to continue working with the scene, locally. Note that this won't affect other people, and they'll still be able to collaborate on their version."
</s> add "desc_intro": "",
"desc_privacy": "",
"button_startSession": "",
"button_stopSession": "",
"desc_inProgressIntro": "",
"desc_persistenceWarning": "",
"desc_shareLink": "",
"desc_exitSession": "" </s> remove "copyAsPng": "Copy to clipboard as PNG",
</s> add "copyAsPng": "",
|
https://github.com/excalidraw/excalidraw/commit/e2e4f3c805837d27b7ab4aa9582dbc457b83dce6
|
src/locales/pt-PT.json
|
replace keep keep keep keep keep
|
<mask> import { ReactNode, useCallback, useEffect, useState } from "react";
<mask> import OpenColor from "open-color";
<mask>
<mask> import { Dialog } from "./Dialog";
<mask> import { t } from "../i18n";
<mask>
</s> refactor: inline `SingleLibraryItem` into `PublishLibrary` (#6462
refactor: inline `SingleLibraryItem` into `PublishLibrary` to reduce api surface area </s> add import { CloseIcon } from "./icons";
import { ToolButton } from "./ToolButton";
import "./PublishLibrary.scss"; </s> remove import { exportToCanvas } from "../packages/utils";
</s> add import { exportToCanvas, exportToSvg } from "../packages/utils"; </s> remove
import "./PublishLibrary.scss";
import SingleLibraryItem from "./SingleLibraryItem";
</s> add
|
https://github.com/excalidraw/excalidraw/commit/e31230f78cc40ff40ef4b4add54131e7c427e655
|
src/components/PublishLibrary.tsx
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> import { Dialog } from "./Dialog";
<mask> import { t } from "../i18n";
<mask>
<mask> import { AppState, LibraryItems, LibraryItem } from "../types";
<mask> import { exportToCanvas } from "../packages/utils";
<mask> import {
<mask> EXPORT_DATA_TYPES,
<mask> EXPORT_SOURCE,
<mask> MIME_TYPES,
<mask> VERSIONS,
</s> refactor: inline `SingleLibraryItem` into `PublishLibrary` (#6462
refactor: inline `SingleLibraryItem` into `PublishLibrary` to reduce api surface area </s> add import { CloseIcon } from "./icons";
import { ToolButton } from "./ToolButton";
import "./PublishLibrary.scss"; </s> remove
import "./PublishLibrary.scss";
import SingleLibraryItem from "./SingleLibraryItem";
</s> add </s> remove import { ReactNode, useCallback, useEffect, useState } from "react";
</s> add import { ReactNode, useCallback, useEffect, useRef, useState } from "react";
|
https://github.com/excalidraw/excalidraw/commit/e31230f78cc40ff40ef4b4add54131e7c427e655
|
src/components/PublishLibrary.tsx
|
keep keep keep keep replace replace replace keep keep keep keep keep
|
<mask> MIME_TYPES,
<mask> VERSIONS,
<mask> } from "../constants";
<mask> import { ExportedLibraryData } from "../data/types";
<mask>
<mask> import "./PublishLibrary.scss";
<mask> import SingleLibraryItem from "./SingleLibraryItem";
<mask> import { canvasToBlob, resizeImageFile } from "../data/blob";
<mask> import { chunk } from "../utils";
<mask> import DialogActionButton from "./DialogActionButton";
<mask>
<mask> interface PublishLibraryDataParams {
</s> refactor: inline `SingleLibraryItem` into `PublishLibrary` (#6462
refactor: inline `SingleLibraryItem` into `PublishLibrary` to reduce api surface area </s> add import { CloseIcon } from "./icons";
import { ToolButton } from "./ToolButton";
import "./PublishLibrary.scss"; </s> remove import { exportToCanvas } from "../packages/utils";
</s> add import { exportToCanvas, exportToSvg } from "../packages/utils"; </s> remove import { ReactNode, useCallback, useEffect, useState } from "react";
</s> add import { ReactNode, useCallback, useEffect, useRef, useState } from "react";
|
https://github.com/excalidraw/excalidraw/commit/e31230f78cc40ff40ef4b4add54131e7c427e655
|
src/components/PublishLibrary.tsx
|
keep keep keep add keep keep keep keep
|
<mask> import { ExportedLibraryData } from "../data/types";
<mask> import { canvasToBlob, resizeImageFile } from "../data/blob";
<mask> import { chunk } from "../utils";
<mask> import DialogActionButton from "./DialogActionButton";
<mask>
<mask> interface PublishLibraryDataParams {
<mask> authorName: string;
<mask> githubHandle: string;
</s> refactor: inline `SingleLibraryItem` into `PublishLibrary` (#6462
refactor: inline `SingleLibraryItem` into `PublishLibrary` to reduce api surface area </s> remove import { exportToCanvas } from "../packages/utils";
</s> add import { exportToCanvas, exportToSvg } from "../packages/utils"; </s> remove
import "./PublishLibrary.scss";
import SingleLibraryItem from "./SingleLibraryItem";
</s> add </s> remove import { ReactNode, useCallback, useEffect, useState } from "react";
</s> add import { ReactNode, useCallback, useEffect, useRef, useState } from "react";
|
https://github.com/excalidraw/excalidraw/commit/e31230f78cc40ff40ef4b4add54131e7c427e655
|
src/components/PublishLibrary.tsx
|
keep add keep keep keep keep keep
|
<mask> "exportToSvg": "Exportar a SVG",
<mask> "copyToClipboard": "Copiar al portapapeles",
<mask> "save": "Guardar",
<mask> "load": "Cargar",
<mask> "getShareableLink": "Obtener enlace para compartir",
<mask> "close": "Cerrar",
<mask> "selectLanguage": "Seleccionar idioma",
</s> New Crowdin translations (#1055)
* New translations en.json (Norwegian)
* New translations en.json (Norwegian)
* New translations en.json (Chinese Simplified)
* New translations en.json (Chinese Simplified)
* New translations en.json (Chinese Simplified)
* New translations en.json (French)
* New translations en.json (German)
* New translations en.json (Indonesian)
* New translations en.json (Norwegian)
* New translations en.json (Polish)
* New translations en.json (Portuguese)
* New translations en.json (Russian)
* New translations en.json (Spanish)
* New translations en.json (Turkish)
* New translations en.json (Korean)
* New translations en.json (Chinese Traditional)
* New translations en.json (Hungarian)
* New translations en.json (Norwegian)
* New translations en.json (French) </s> add "copyPngToClipboard": "Copy PNG to clipboard", </s> add "copyPngToClipboard": "Copy PNG to clipboard", </s> remove "desc_shareLink": "Share this link with anyone you want to collaborate with:",
</s> add "desc_shareLink": "Del denne linken med de du vil samarbeide med:", </s> remove "errorStack_loading": "Loading data. please wait...",
</s> add "errorStack_loading": "Laster inn, vennligst vent...",
|
https://github.com/excalidraw/excalidraw/commit/e38045ccad54746c90cff739756767aeebe424c1
|
src/locales/es-ES.json
|
keep add keep keep keep keep
|
<mask> "exportToSvg": "Ekspor ke SVG",
<mask> "copyToClipboard": "Salin ke Papan Klip",
<mask> "save": "Simpan",
<mask> "load": "Muat",
<mask> "getShareableLink": "Buat Tautan yang Bisa Dibagian",
<mask> "close": "Tutup",
</s> New Crowdin translations (#1055)
* New translations en.json (Norwegian)
* New translations en.json (Norwegian)
* New translations en.json (Chinese Simplified)
* New translations en.json (Chinese Simplified)
* New translations en.json (Chinese Simplified)
* New translations en.json (French)
* New translations en.json (German)
* New translations en.json (Indonesian)
* New translations en.json (Norwegian)
* New translations en.json (Polish)
* New translations en.json (Portuguese)
* New translations en.json (Russian)
* New translations en.json (Spanish)
* New translations en.json (Turkish)
* New translations en.json (Korean)
* New translations en.json (Chinese Traditional)
* New translations en.json (Hungarian)
* New translations en.json (Norwegian)
* New translations en.json (French) </s> add "copyPngToClipboard": "Copy PNG to clipboard", </s> add "copyPngToClipboard": "Copy PNG to clipboard", </s> remove "desc_shareLink": "Share this link with anyone you want to collaborate with:",
</s> add "desc_shareLink": "Del denne linken med de du vil samarbeide med:", </s> remove "errorStack_loading": "Loading data. please wait...",
</s> add "errorStack_loading": "Laster inn, vennligst vent...",
|
https://github.com/excalidraw/excalidraw/commit/e38045ccad54746c90cff739756767aeebe424c1
|
src/locales/id-ID.json
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "openIssueMessage_pre": "Before doing so, we'd appreciate if you opened an issue on our ",
<mask> "openIssueMessage_button": "bug tracker.",
<mask> "openIssueMessage_post": " Please include the following error stack trace (and if it's not private, also the scene content):",
<mask> "errorStack": "Error stack trace:",
<mask> "errorStack_loading": "Loading data. please wait...",
<mask> "sceneContent": "Scene content:"
<mask> },
<mask> "roomDialog": {
<mask> "desc_intro": "You can invite people to your current scene to collaborate with you.",
<mask> "desc_privacy": "Don't worry, the session uses end-to-end encryption, so whatever you draw will stay private. Not even our server will be able to see what you come up with.",
</s> New Crowdin translations (#1055)
* New translations en.json (Norwegian)
* New translations en.json (Norwegian)
* New translations en.json (Chinese Simplified)
* New translations en.json (Chinese Simplified)
* New translations en.json (Chinese Simplified)
* New translations en.json (French)
* New translations en.json (German)
* New translations en.json (Indonesian)
* New translations en.json (Norwegian)
* New translations en.json (Polish)
* New translations en.json (Portuguese)
* New translations en.json (Russian)
* New translations en.json (Spanish)
* New translations en.json (Turkish)
* New translations en.json (Korean)
* New translations en.json (Chinese Traditional)
* New translations en.json (Hungarian)
* New translations en.json (Norwegian)
* New translations en.json (French) </s> remove "desc_shareLink": "Share this link with anyone you want to collaborate with:",
</s> add "desc_shareLink": "Del denne linken med de du vil samarbeide med:", </s> add "copyPngToClipboard": "Copy PNG to clipboard", </s> add "copyPngToClipboard": "Copy PNG to clipboard", </s> add "copyPngToClipboard": "Copy PNG to clipboard",
|
https://github.com/excalidraw/excalidraw/commit/e38045ccad54746c90cff739756767aeebe424c1
|
src/locales/no-NO.json
|
keep keep keep keep replace keep keep keep
|
<mask> "button_startSession": "Start session",
<mask> "button_stopSession": "Stop session",
<mask> "desc_inProgressIntro": "Live-collaboration session is now in progress.",
<mask> "desc_persistenceWarning": "Note that the scene data is shared across collaborators in a P2P fashion, and not persisted to our server. Thus, if all of you disconnect, you will loose the data unless you export it to a file or a shareable link.",
<mask> "desc_shareLink": "Share this link with anyone you want to collaborate with:",
<mask> "desc_exitSession": "Stopping the session will disconnect your from the room, but you'll be able to continue working with the scene, locally. Note that this won't affect other people, and they'll still be able to collaborate on their version."
<mask> }
<mask> }
</s> New Crowdin translations (#1055)
* New translations en.json (Norwegian)
* New translations en.json (Norwegian)
* New translations en.json (Chinese Simplified)
* New translations en.json (Chinese Simplified)
* New translations en.json (Chinese Simplified)
* New translations en.json (French)
* New translations en.json (German)
* New translations en.json (Indonesian)
* New translations en.json (Norwegian)
* New translations en.json (Polish)
* New translations en.json (Portuguese)
* New translations en.json (Russian)
* New translations en.json (Spanish)
* New translations en.json (Turkish)
* New translations en.json (Korean)
* New translations en.json (Chinese Traditional)
* New translations en.json (Hungarian)
* New translations en.json (Norwegian)
* New translations en.json (French) </s> remove "errorStack_loading": "Loading data. please wait...",
</s> add "errorStack_loading": "Laster inn, vennligst vent...", </s> add "copyPngToClipboard": "Copy PNG to clipboard", </s> add "copyPngToClipboard": "Copy PNG to clipboard", </s> add "copyPngToClipboard": "Copy PNG to clipboard",
|
https://github.com/excalidraw/excalidraw/commit/e38045ccad54746c90cff739756767aeebe424c1
|
src/locales/no-NO.json
|
keep add keep keep keep keep
|
<mask> "exportToSvg": "Exportar em SVG",
<mask> "copyToClipboard": "Copiar para o clipboard",
<mask> "save": "Guardar",
<mask> "load": "Carregar",
<mask> "getShareableLink": "Obter um link de partilha",
<mask> "close": "Fechar",
</s> New Crowdin translations (#1055)
* New translations en.json (Norwegian)
* New translations en.json (Norwegian)
* New translations en.json (Chinese Simplified)
* New translations en.json (Chinese Simplified)
* New translations en.json (Chinese Simplified)
* New translations en.json (French)
* New translations en.json (German)
* New translations en.json (Indonesian)
* New translations en.json (Norwegian)
* New translations en.json (Polish)
* New translations en.json (Portuguese)
* New translations en.json (Russian)
* New translations en.json (Spanish)
* New translations en.json (Turkish)
* New translations en.json (Korean)
* New translations en.json (Chinese Traditional)
* New translations en.json (Hungarian)
* New translations en.json (Norwegian)
* New translations en.json (French) </s> add "copyPngToClipboard": "Copy PNG to clipboard", </s> add "copyPngToClipboard": "Copy PNG to clipboard", </s> remove "desc_shareLink": "Share this link with anyone you want to collaborate with:",
</s> add "desc_shareLink": "Del denne linken med de du vil samarbeide med:", </s> remove "errorStack_loading": "Loading data. please wait...",
</s> add "errorStack_loading": "Laster inn, vennligst vent...",
|
https://github.com/excalidraw/excalidraw/commit/e38045ccad54746c90cff739756767aeebe424c1
|
src/locales/pt-PT.json
|
keep replace keep replace keep keep keep
|
<mask> transform: "translate(-50%, -50%)",
<mask> boxShadow: "none",
<mask> textAlign: "center",
<mask> width: (window.innerWidth - x) * 2 + "px",
<mask> font: font,
<mask> border: "none",
<mask> background: "transparent"
</s> Contenteditable wysiwyg (#274)
* Contenteditable wysiwyg
* Added comment about pasting multiline text </s> remove border: "none",
background: "transparent"
</s> add padding: "4px",
outline: "transparent",
whiteSpace: "nowrap" </s> remove input.onkeydown = ev => {
</s> add editable.onkeydown = ev => { </s> add (target instanceof HTMLElement && target.dataset.type === "wysiwyg") || </s> remove document.body.appendChild(input);
input.focus();
input.select();
</s> add document.body.appendChild(editable);
editable.focus();
const selection = window.getSelection();
if (selection) {
const range = document.createRange();
range.selectNodeContents(editable);
selection.removeAllRanges();
selection.addRange(range);
} </s> remove document.body.removeChild(input);
</s> add document.body.removeChild(editable);
|
https://github.com/excalidraw/excalidraw/commit/e38f65dea781b91386de8b3671c52adb192dd651
|
src/element/textWysiwyg.tsx
|
keep keep keep replace replace keep keep replace keep keep
|
<mask> textAlign: "center",
<mask> width: (window.innerWidth - x) * 2 + "px",
<mask> font: font,
<mask> border: "none",
<mask> background: "transparent"
<mask> });
<mask>
<mask> input.onkeydown = ev => {
<mask> if (ev.key === KEYS.ESCAPE) {
<mask> ev.preventDefault();
</s> Contenteditable wysiwyg (#274)
* Contenteditable wysiwyg
* Added comment about pasting multiline text </s> remove width: (window.innerWidth - x) * 2 + "px",
</s> add display: "inline-block", </s> remove boxShadow: "none",
</s> add </s> remove input.value = initText;
</s> add editable.innerText = initText; </s> remove input.onblur = handleSubmit;
</s> add editable.onblur = handleSubmit; </s> remove if (input.value) {
onSubmit(input.value);
</s> add if (editable.innerText) {
onSubmit(editable.innerText);
|
https://github.com/excalidraw/excalidraw/commit/e38f65dea781b91386de8b3671c52adb192dd651
|
src/element/textWysiwyg.tsx
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> input.onkeydown = ev => {
<mask> if (ev.key === KEYS.ESCAPE) {
<mask> ev.preventDefault();
<mask> if (initText) {
<mask> input.value = initText;
<mask> handleSubmit();
<mask> return;
<mask> }
<mask> cleanup();
<mask> return;
</s> Contenteditable wysiwyg (#274)
* Contenteditable wysiwyg
* Added comment about pasting multiline text </s> remove input.onkeydown = ev => {
</s> add editable.onkeydown = ev => { </s> remove border: "none",
background: "transparent"
</s> add padding: "4px",
outline: "transparent",
whiteSpace: "nowrap" </s> remove input.onblur = handleSubmit;
</s> add editable.onblur = handleSubmit; </s> remove if (input.value) {
onSubmit(input.value);
</s> add if (editable.innerText) {
onSubmit(editable.innerText); </s> remove input.onblur = null;
input.onkeydown = null;
</s> add editable.onblur = null;
editable.onkeydown = null; </s> remove document.body.appendChild(input);
input.focus();
input.select();
</s> add document.body.appendChild(editable);
editable.focus();
const selection = window.getSelection();
if (selection) {
const range = document.createRange();
range.selectNodeContents(editable);
selection.removeAllRanges();
selection.addRange(range);
}
|
https://github.com/excalidraw/excalidraw/commit/e38f65dea781b91386de8b3671c52adb192dd651
|
src/element/textWysiwyg.tsx
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> ev.preventDefault();
<mask> handleSubmit();
<mask> }
<mask> };
<mask> input.onblur = handleSubmit;
<mask>
<mask> function stopEvent(ev: Event) {
<mask> ev.stopPropagation();
<mask> }
<mask>
</s> Contenteditable wysiwyg (#274)
* Contenteditable wysiwyg
* Added comment about pasting multiline text </s> remove if (input.value) {
onSubmit(input.value);
</s> add if (editable.innerText) {
onSubmit(editable.innerText); </s> remove input.onblur = null;
input.onkeydown = null;
</s> add editable.onblur = null;
editable.onkeydown = null; </s> remove input.value = initText;
</s> add editable.innerText = initText; </s> remove document.body.removeChild(input);
</s> add document.body.removeChild(editable); </s> remove input.onkeydown = ev => {
</s> add editable.onkeydown = ev => { </s> remove document.body.appendChild(input);
input.focus();
input.select();
</s> add document.body.appendChild(editable);
editable.focus();
const selection = window.getSelection();
if (selection) {
const range = document.createRange();
range.selectNodeContents(editable);
selection.removeAllRanges();
selection.addRange(range);
}
|
https://github.com/excalidraw/excalidraw/commit/e38f65dea781b91386de8b3671c52adb192dd651
|
src/element/textWysiwyg.tsx
|
keep keep keep keep replace replace keep keep keep keep keep
|
<mask> ev.stopPropagation();
<mask> }
<mask>
<mask> function handleSubmit() {
<mask> if (input.value) {
<mask> onSubmit(input.value);
<mask> }
<mask> cleanup();
<mask> }
<mask>
<mask> function cleanup() {
</s> Contenteditable wysiwyg (#274)
* Contenteditable wysiwyg
* Added comment about pasting multiline text </s> remove input.onblur = handleSubmit;
</s> add editable.onblur = handleSubmit; </s> remove input.onblur = null;
input.onkeydown = null;
</s> add editable.onblur = null;
editable.onkeydown = null; </s> remove document.body.removeChild(input);
</s> add document.body.removeChild(editable); </s> remove input.value = initText;
</s> add editable.innerText = initText; </s> remove document.body.appendChild(input);
input.focus();
input.select();
</s> add document.body.appendChild(editable);
editable.focus();
const selection = window.getSelection();
if (selection) {
const range = document.createRange();
range.selectNodeContents(editable);
selection.removeAllRanges();
selection.addRange(range);
} </s> remove input.onkeydown = ev => {
</s> add editable.onkeydown = ev => {
|
https://github.com/excalidraw/excalidraw/commit/e38f65dea781b91386de8b3671c52adb192dd651
|
src/element/textWysiwyg.tsx
|
keep keep keep keep replace replace keep replace keep keep
|
<mask> cleanup();
<mask> }
<mask>
<mask> function cleanup() {
<mask> input.onblur = null;
<mask> input.onkeydown = null;
<mask> window.removeEventListener("wheel", stopEvent, true);
<mask> document.body.removeChild(input);
<mask> }
<mask>
</s> Contenteditable wysiwyg (#274)
* Contenteditable wysiwyg
* Added comment about pasting multiline text </s> remove document.body.appendChild(input);
input.focus();
input.select();
</s> add document.body.appendChild(editable);
editable.focus();
const selection = window.getSelection();
if (selection) {
const range = document.createRange();
range.selectNodeContents(editable);
selection.removeAllRanges();
selection.addRange(range);
} </s> remove if (input.value) {
onSubmit(input.value);
</s> add if (editable.innerText) {
onSubmit(editable.innerText); </s> remove input.onblur = handleSubmit;
</s> add editable.onblur = handleSubmit; </s> remove input.value = initText;
</s> add editable.innerText = initText; </s> remove input.onkeydown = ev => {
</s> add editable.onkeydown = ev => {
|
https://github.com/excalidraw/excalidraw/commit/e38f65dea781b91386de8b3671c52adb192dd651
|
src/element/textWysiwyg.tsx
|
keep keep keep keep replace replace replace keep
|
<mask> document.body.removeChild(input);
<mask> }
<mask>
<mask> window.addEventListener("wheel", stopEvent, true);
<mask> document.body.appendChild(input);
<mask> input.focus();
<mask> input.select();
<mask> }
</s> Contenteditable wysiwyg (#274)
* Contenteditable wysiwyg
* Added comment about pasting multiline text </s> remove document.body.removeChild(input);
</s> add document.body.removeChild(editable); </s> remove input.onblur = null;
input.onkeydown = null;
</s> add editable.onblur = null;
editable.onkeydown = null; </s> remove if (input.value) {
onSubmit(input.value);
</s> add if (editable.innerText) {
onSubmit(editable.innerText); </s> remove input.onblur = handleSubmit;
</s> add editable.onblur = handleSubmit; </s> remove input.value = initText;
</s> add editable.innerText = initText; </s> add (target instanceof HTMLElement && target.dataset.type === "wysiwyg") ||
|
https://github.com/excalidraw/excalidraw/commit/e38f65dea781b91386de8b3671c52adb192dd651
|
src/element/textWysiwyg.tsx
|
keep add keep keep keep keep
|
<mask> ): target is HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement {
<mask> return (
<mask> target instanceof HTMLInputElement ||
<mask> target instanceof HTMLTextAreaElement ||
<mask> target instanceof HTMLSelectElement
<mask> );
</s> Contenteditable wysiwyg (#274)
* Contenteditable wysiwyg
* Added comment about pasting multiline text </s> remove if (input.value) {
onSubmit(input.value);
</s> add if (editable.innerText) {
onSubmit(editable.innerText); </s> remove input.onkeydown = ev => {
</s> add editable.onkeydown = ev => { </s> remove input.value = initText;
</s> add editable.innerText = initText; </s> remove border: "none",
background: "transparent"
</s> add padding: "4px",
outline: "transparent",
whiteSpace: "nowrap" </s> remove input.onblur = handleSubmit;
</s> add editable.onblur = handleSubmit; </s> remove document.body.removeChild(input);
</s> add document.body.removeChild(editable);
|
https://github.com/excalidraw/excalidraw/commit/e38f65dea781b91386de8b3671c52adb192dd651
|
src/utils.ts
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> const res = measureText(text, font, maxWidth);
<mask>
<mask> expect(res.container).toMatchInlineSnapshot(`
<mask> <div
<mask> style="position: absolute; white-space: pre-wrap; font: Emoji 20px 20px; min-height: 1em; width: 111px; overflow: hidden; word-break: break-word; line-height: 0px;"
<mask> >
<mask> <span
<mask> style="display: inline-block; overflow: hidden; width: 1px; height: 1px;"
<mask> />
<mask> </div>
</s> fix: set the width correctly using measureText in editor (#6162) </s> remove return metrics.width;
</s> add return metrics.width + adjustmentFactor; </s> add const wrappedText = wrapText(
normalizeText(editable.value),
font,
getMaxContainerWidth(container!),
);
const width = getTextWidth(wrappedText, font);
editable.style.width = `${width}px`;
</s> remove const container = getContainerElement(element);
</s> add </s> remove // Since span adds 1px extra width to the container
let width = container.offsetWidth;
if (maxWidth && textWidth > maxWidth) {
width = width - 1;
}
</s> add const width = container.offsetWidth; </s> add const container = getContainerElement(element);
</s> remove const textWidth = getTextWidth(text, font);
</s> add
|
https://github.com/excalidraw/excalidraw/commit/e41ea9562b1142dafd99509c7be90f9370e4c925
|
src/element/textElement.test.ts
|
keep keep replace keep keep keep replace replace
|
<mask> container.style.font = font;
<mask> container.style.minHeight = "1em";
<mask> const textWidth = getTextWidth(text, font);
<mask>
<mask> if (maxWidth) {
<mask> const lineHeight = getApproxLineHeight(font);
<mask> container.style.width = `${String(Math.min(textWidth, maxWidth) + 1)}px`;
<mask>
</s> fix: set the width correctly using measureText in editor (#6162) </s> remove // Since span adds 1px extra width to the container
let width = container.offsetWidth;
if (maxWidth && textWidth > maxWidth) {
width = width - 1;
}
</s> add const width = container.offsetWidth; </s> add const wrappedText = wrapText(
normalizeText(editable.value),
font,
getMaxContainerWidth(container!),
);
const width = getTextWidth(wrappedText, font);
editable.style.width = `${width}px`;
</s> remove const container = getContainerElement(element);
</s> add </s> remove return metrics.width;
</s> add return metrics.width + adjustmentFactor; </s> add const container = getContainerElement(element);
|
https://github.com/excalidraw/excalidraw/commit/e41ea9562b1142dafd99509c7be90f9370e4c925
|
src/element/textElement.ts
|
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
|
<mask> span.style.height = "1px";
<mask> container.appendChild(span);
<mask> // Baseline is important for positioning text on canvas
<mask> const baseline = span.offsetTop + span.offsetHeight;
<mask> // Since span adds 1px extra width to the container
<mask> let width = container.offsetWidth;
<mask> if (maxWidth && textWidth > maxWidth) {
<mask> width = width - 1;
<mask> }
<mask> const height = container.offsetHeight;
<mask> document.body.removeChild(container);
<mask> if (isTestEnv()) {
<mask> return { width, height, baseline, container };
<mask> }
</s> fix: set the width correctly using measureText in editor (#6162) </s> add const container = getContainerElement(element);
</s> remove container.style.width = `${String(Math.min(textWidth, maxWidth) + 1)}px`;
</s> add // since we are adding a span of width 1px later
container.style.maxWidth = `${maxWidth + 1}px`; </s> remove return metrics.width;
</s> add return metrics.width + adjustmentFactor; </s> add // Since measureText behaves differently in different browsers
// OS so considering a adjustment factor of 0.2
const adjustmentFactor = 0.2; </s> remove const container = getContainerElement(element);
</s> add </s> add const wrappedText = wrapText(
normalizeText(editable.value),
font,
getMaxContainerWidth(container!),
);
const width = getTextWidth(wrappedText, font);
editable.style.width = `${width}px`;
|
https://github.com/excalidraw/excalidraw/commit/e41ea9562b1142dafd99509c7be90f9370e4c925
|
src/element/textElement.ts
|
keep keep add keep keep keep keep
|
<mask> if (isTestEnv()) {
<mask> return metrics.width * 10;
<mask> }
<mask>
<mask> return metrics.width + adjustmentFactor;
<mask> };
<mask>
</s> fix: set the width correctly using measureText in editor (#6162) </s> remove return metrics.width;
</s> add return metrics.width + adjustmentFactor; </s> remove // Since span adds 1px extra width to the container
let width = container.offsetWidth;
if (maxWidth && textWidth > maxWidth) {
width = width - 1;
}
</s> add const width = container.offsetWidth; </s> add const wrappedText = wrapText(
normalizeText(editable.value),
font,
getMaxContainerWidth(container!),
);
const width = getTextWidth(wrappedText, font);
editable.style.width = `${width}px`;
</s> remove container.style.width = `${String(Math.min(textWidth, maxWidth) + 1)}px`;
</s> add // since we are adding a span of width 1px later
container.style.maxWidth = `${maxWidth + 1}px`; </s> remove const textWidth = getTextWidth(text, font);
</s> add </s> add const container = getContainerElement(element);
|
https://github.com/excalidraw/excalidraw/commit/e41ea9562b1142dafd99509c7be90f9370e4c925
|
src/element/textElement.ts
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> if (isTestEnv()) {
<mask> return metrics.width * 10;
<mask> }
<mask>
<mask> return metrics.width;
<mask> };
<mask>
<mask> export const getTextWidth = (text: string, font: FontString) => {
<mask> const lines = text.split("\n");
<mask> let width = 0;
</s> fix: set the width correctly using measureText in editor (#6162) </s> add // Since measureText behaves differently in different browsers
// OS so considering a adjustment factor of 0.2
const adjustmentFactor = 0.2; </s> remove // Since span adds 1px extra width to the container
let width = container.offsetWidth;
if (maxWidth && textWidth > maxWidth) {
width = width - 1;
}
</s> add const width = container.offsetWidth; </s> add const wrappedText = wrapText(
normalizeText(editable.value),
font,
getMaxContainerWidth(container!),
);
const width = getTextWidth(wrappedText, font);
editable.style.width = `${width}px`;
</s> add const container = getContainerElement(element);
</s> remove const container = getContainerElement(element);
</s> add </s> remove container.style.width = `${String(Math.min(textWidth, maxWidth) + 1)}px`;
</s> add // since we are adding a span of width 1px later
container.style.maxWidth = `${maxWidth + 1}px`;
|
https://github.com/excalidraw/excalidraw/commit/e41ea9562b1142dafd99509c7be90f9370e4c925
|
src/element/textElement.ts
|
keep keep keep add keep keep keep keep keep
|
<mask> // measured correctly and vertically aligns for
<mask> // first line as well as setting height to "auto"
<mask> // doubles the height as soon as user starts typing
<mask> if (isBoundToContainer(element) && lines > 1) {
<mask> let height = "auto";
<mask> editable.style.height = "0px";
<mask> let heightSet = false;
<mask> if (lines === 2) {
<mask> const actualLineCount = wrapText(
</s> fix: set the width correctly using measureText in editor (#6162) </s> remove const container = getContainerElement(element);
</s> add </s> remove // Since span adds 1px extra width to the container
let width = container.offsetWidth;
if (maxWidth && textWidth > maxWidth) {
width = width - 1;
}
</s> add const width = container.offsetWidth; </s> add const wrappedText = wrapText(
normalizeText(editable.value),
font,
getMaxContainerWidth(container!),
);
const width = getTextWidth(wrappedText, font);
editable.style.width = `${width}px`;
</s> remove return metrics.width;
</s> add return metrics.width + adjustmentFactor; </s> remove container.style.width = `${String(Math.min(textWidth, maxWidth) + 1)}px`;
</s> add // since we are adding a span of width 1px later
container.style.maxWidth = `${maxWidth + 1}px`; </s> remove const textWidth = getTextWidth(text, font);
</s> add
|
https://github.com/excalidraw/excalidraw/commit/e41ea9562b1142dafd99509c7be90f9370e4c925
|
src/element/textWysiwyg.tsx
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> let height = "auto";
<mask> editable.style.height = "0px";
<mask> let heightSet = false;
<mask> if (lines === 2) {
<mask> const container = getContainerElement(element);
<mask> const actualLineCount = wrapText(
<mask> editable.value,
<mask> font,
<mask> getMaxContainerWidth(container!),
<mask> ).split("\n").length;
</s> fix: set the width correctly using measureText in editor (#6162) </s> add const container = getContainerElement(element);
</s> add const wrappedText = wrapText(
normalizeText(editable.value),
font,
getMaxContainerWidth(container!),
);
const width = getTextWidth(wrappedText, font);
editable.style.width = `${width}px`;
</s> remove // Since span adds 1px extra width to the container
let width = container.offsetWidth;
if (maxWidth && textWidth > maxWidth) {
width = width - 1;
}
</s> add const width = container.offsetWidth; </s> remove const textWidth = getTextWidth(text, font);
</s> add </s> remove return metrics.width;
</s> add return metrics.width + adjustmentFactor; </s> remove container.style.width = `${String(Math.min(textWidth, maxWidth) + 1)}px`;
</s> add // since we are adding a span of width 1px later
container.style.maxWidth = `${maxWidth + 1}px`;
|
https://github.com/excalidraw/excalidraw/commit/e41ea9562b1142dafd99509c7be90f9370e4c925
|
src/element/textWysiwyg.tsx
|
keep add keep keep keep keep
|
<mask> }
<mask> }
<mask> if (!heightSet) {
<mask> editable.style.height = `${editable.scrollHeight}px`;
<mask> }
<mask> }
</s> fix: set the width correctly using measureText in editor (#6162) </s> remove // Since span adds 1px extra width to the container
let width = container.offsetWidth;
if (maxWidth && textWidth > maxWidth) {
width = width - 1;
}
</s> add const width = container.offsetWidth; </s> remove return metrics.width;
</s> add return metrics.width + adjustmentFactor; </s> remove container.style.width = `${String(Math.min(textWidth, maxWidth) + 1)}px`;
</s> add // since we are adding a span of width 1px later
container.style.maxWidth = `${maxWidth + 1}px`; </s> add // Since measureText behaves differently in different browsers
// OS so considering a adjustment factor of 0.2
const adjustmentFactor = 0.2; </s> remove const container = getContainerElement(element);
</s> add </s> add const container = getContainerElement(element);
|
https://github.com/excalidraw/excalidraw/commit/e41ea9562b1142dafd99509c7be90f9370e4c925
|
src/element/textWysiwyg.tsx
|
keep replace keep keep keep keep replace
|
<mask> .color-picker {
<mask> width: 205px;
<mask> background: rgb(255, 255, 255);
<mask> border: 0px solid rgba(0, 0, 0, 0.25);
<mask> box-shadow: rgba(0, 0, 0, 0.25) 0px 1px 4px;
<mask> border-radius: 4px;
<mask> position: relative;
</s> Restyle the color picker a touch (#920) </s> remove .color-picker-triangle-shadow {
width: 0px;
height: 0px;
border-style: solid;
border-width: 0px 9px 10px;
border-color: transparent transparent rgba(0, 0, 0, 0.1);
position: absolute;
top: -11px;
left: 12px;
}
</s> add </s> add .color-picker-triangle-shadow {
border-color: transparent transparent rgba(0, 0, 0, 0.1);
top: -11px;
}
</s> remove margin: 0px 0.375rem 0.375rem 0px;
</s> add margin: 0; </s> remove box-sizing: content-box;
</s> add </s> add position: relative;
overflow: hidden;
background-color: transparent !important;
}
.color-picker-label-swatch::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: var(--swatch-color);
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ColorPicker.css
|
keep replace keep keep keep replace replace replace replace replace replace replace replace replace replace replace keep
|
<mask> .color-picker-control-container {
<mask> display: flex;
<mask> align-items: center;
<mask> }
<mask>
<mask> .color-picker-triangle-shadow {
<mask> width: 0px;
<mask> height: 0px;
<mask> border-style: solid;
<mask> border-width: 0px 9px 10px;
<mask> border-color: transparent transparent rgba(0, 0, 0, 0.1);
<mask> position: absolute;
<mask> top: -11px;
<mask> left: 12px;
<mask> }
<mask>
<mask> .color-picker-triangle {
</s> Restyle the color picker a touch (#920) </s> add .color-picker-triangle-shadow {
border-color: transparent transparent rgba(0, 0, 0, 0.1);
top: -11px;
}
</s> remove position: relative;
</s> add position: absolute;
left: -5.5px; </s> add position: relative;
overflow: hidden;
background-color: transparent !important;
}
.color-picker-label-swatch::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: var(--swatch-color); </s> remove width: 205px;
</s> add </s> add }
.color-picker-transparent,
.color-picker-label-swatch {
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ColorPicker.css
|
keep add keep keep keep keep
|
<mask> }
<mask>
<mask> .color-picker-content {
<mask> padding: 0.5rem 0.5rem;
<mask> display: grid;
<mask> grid-template-columns: repeat(5, auto);
</s> Restyle the color picker a touch (#920) </s> remove padding: 1rem 0.5rem 0.5rem 1rem;
</s> add padding: 0.5rem 0.5rem;
display: grid;
grid-template-columns: repeat(5, auto);
grid-gap: 0.5rem; </s> remove .colors-gallery {
display: flex;
flex-wrap: wrap;
</s> add .color-picker-content .color-input-container {
grid-column: 1 / span 5; </s> remove display: flex;
</s> add display: grid;
grid-template-columns: auto 1fr; </s> remove height: 2.5rem;
line-height: 2.5rem;
padding: 0 0.5rem;
</s> add line-height: 1;
padding: 0.75rem; </s> remove --metric: calc(var(--space-factor) * 4);
</s> add </s> add .Dialog {
--metric: calc(var(--space-factor) * 4);
--inset-left: #{"max(var(--metric), env(safe-area-inset-left))"};
--inset-right: #{"max(var(--metric), env(safe-area-inset-right))"};
}
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ColorPicker.css
|
keep keep keep replace keep keep replace replace replace keep keep keep
|
<mask> }
<mask>
<mask> .color-picker-content {
<mask> padding: 1rem 0.5rem 0.5rem 1rem;
<mask> }
<mask>
<mask> .colors-gallery {
<mask> display: flex;
<mask> flex-wrap: wrap;
<mask> }
<mask>
<mask> .color-picker-swatch {
</s> Restyle the color picker a touch (#920) </s> add .color-picker-triangle-shadow {
border-color: transparent transparent rgba(0, 0, 0, 0.1);
top: -11px;
}
</s> remove flex-wrap: wrap;
</s> add </s> remove .ExportDialog__scales {
display: flex;
align-items: baseline;
justify-content: flex-end;
</s> add .ExportDialog__name {
grid-column: project-name;
margin: auto;
}
@media (max-width: 550px) {
.ExportDialog {
display: flex;
flex-direction: column;
}
.ExportDialog__actions {
flex-direction: column;
align-items: center;
}
.ExportDialog__actions > * {
margin-bottom: calc(var(--space-factor) * 3);
} </s> remove display: flex;
</s> add display: grid;
grid-template-columns: auto 1fr; </s> remove width: 6.25em;
</s> add width: 12ch; /* length of `transparent` + 1 */
margin: 0;
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ColorPicker.css
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> height: 1.875rem;
<mask> width: 1.875rem;
<mask> cursor: pointer;
<mask> border-radius: 4px;
<mask> margin: 0px 0.375rem 0.375rem 0px;
<mask> box-sizing: border-box;
<mask> border: 1px solid #ddd;
<mask> }
<mask>
<mask> .color-picker-swatch:focus {
</s> Restyle the color picker a touch (#920) </s> remove width: 205px;
</s> add </s> remove box-sizing: content-box;
</s> add </s> remove height: 2.5rem;
line-height: 2.5rem;
padding: 0 0.5rem;
</s> add line-height: 1;
padding: 0.75rem; </s> remove position: relative;
</s> add position: absolute;
left: -5.5px; </s> add position: relative;
overflow: hidden;
background-color: transparent !important;
}
.color-picker-label-swatch::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: var(--swatch-color); </s> remove .color-picker-triangle-shadow {
width: 0px;
height: 0px;
border-style: solid;
border-width: 0px 9px 10px;
border-color: transparent transparent rgba(0, 0, 0, 0.1);
position: absolute;
top: -11px;
left: 12px;
}
</s> add
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ColorPicker.css
|
keep keep keep add keep keep keep keep keep
|
<mask> top: 0px;
<mask> right: 0px;
<mask> bottom: 0px;
<mask> left: 0px;
<mask> background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAMUlEQVQ4T2NkYGAQYcAP3uCTZhw1gGGYhAGBZIA/nYDCgBDAm9BGDWAAJyRCgLaBCAAgXwixzAS0pgAAAABJRU5ErkJggg==")
<mask> left center;
<mask> }
<mask>
<mask> .color-picker-hash {
</s> Restyle the color picker a touch (#920) </s> remove .color-picker-triangle-shadow {
width: 0px;
height: 0px;
border-style: solid;
border-width: 0px 9px 10px;
border-color: transparent transparent rgba(0, 0, 0, 0.1);
position: absolute;
top: -11px;
left: 12px;
}
</s> add </s> remove display: flex;
</s> add display: grid;
grid-template-columns: auto 1fr; </s> remove box-sizing: content-box;
</s> add </s> remove margin: 0px 0.375rem 0.375rem 0px;
</s> add margin: 0; </s> remove width: 6.25em;
</s> add width: 12ch; /* length of `transparent` + 1 */
margin: 0; </s> add position: relative;
overflow: hidden;
background-color: transparent !important;
}
.color-picker-label-swatch::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: var(--swatch-color);
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ColorPicker.css
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> display: flex;
<mask> }
<mask>
<mask> .color-picker-input {
<mask> width: 6.25em;
<mask> font-size: 1rem;
<mask> color: #343a40;
<mask> border: 0px;
<mask> outline: none;
<mask> height: 1.75em;
</s> Restyle the color picker a touch (#920) </s> remove box-sizing: content-box;
</s> add </s> remove .color-picker-triangle-shadow {
width: 0px;
height: 0px;
border-style: solid;
border-width: 0px 9px 10px;
border-color: transparent transparent rgba(0, 0, 0, 0.1);
position: absolute;
top: -11px;
left: 12px;
}
</s> add </s> remove display: flex;
</s> add display: grid;
grid-template-columns: auto 1fr; </s> remove .colors-gallery {
display: flex;
flex-wrap: wrap;
</s> add .color-picker-content .color-input-container {
grid-column: 1 / span 5; </s> remove margin: 0px 0.375rem 0.375rem 0px;
</s> add margin: 0; </s> remove padding: 1rem 0.5rem 0.5rem 1rem;
</s> add padding: 0.5rem 0.5rem;
display: grid;
grid-template-columns: repeat(5, auto);
grid-gap: 0.5rem;
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ColorPicker.css
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> border: 0px;
<mask> outline: none;
<mask> height: 1.75em;
<mask> box-shadow: #dee2e6 0px 0px 0px 1px inset;
<mask> box-sizing: content-box;
<mask> border-radius: 0px 4px 4px 0px;
<mask> float: left;
<mask> padding: 1px;
<mask> padding-left: 0.5em;
<mask> appearance: none;
</s> Restyle the color picker a touch (#920) </s> remove margin: 0px 0.375rem 0.375rem 0px;
</s> add margin: 0; </s> remove width: 205px;
</s> add </s> remove width: 6.25em;
</s> add width: 12ch; /* length of `transparent` + 1 */
margin: 0; </s> remove position: relative;
</s> add position: absolute;
left: -5.5px; </s> remove .color-picker-triangle-shadow {
width: 0px;
height: 0px;
border-style: solid;
border-width: 0px 9px 10px;
border-color: transparent transparent rgba(0, 0, 0, 0.1);
position: absolute;
top: -11px;
left: 12px;
}
</s> add </s> remove padding: calc(var(--space-factor) * 2) var(--metric);
</s> add padding: calc(var(--space-factor) * 2);
padding-left: var(--inset-left);
padding-right: var(--inset-right);
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ColorPicker.css
|
keep keep add keep keep keep keep keep
|
<mask> width: 1.875rem;
<mask> margin-right: 0.25rem;
<mask> border: 1px solid #dee2e6;
<mask> }
<mask>
<mask> .color-picker-keybinding {
<mask> position: absolute;
<mask> bottom: 2px;
</s> Restyle the color picker a touch (#920) </s> remove margin: 0px 0.375rem 0.375rem 0px;
</s> add margin: 0; </s> remove position: relative;
</s> add position: absolute;
left: -5.5px; </s> remove width: 205px;
</s> add </s> remove .color-picker-triangle-shadow {
width: 0px;
height: 0px;
border-style: solid;
border-width: 0px 9px 10px;
border-color: transparent transparent rgba(0, 0, 0, 0.1);
position: absolute;
top: -11px;
left: 12px;
}
</s> add </s> remove .colors-gallery {
display: flex;
flex-wrap: wrap;
</s> add .color-picker-content .color-input-container {
grid-column: 1 / span 5; </s> add }
.color-picker-transparent,
.color-picker-label-swatch {
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ColorPicker.css
|
keep keep add keep keep keep keep
|
<mask> onChange,
<mask> onClose,
<mask> label,
<mask> }: {
<mask> colors: string[];
<mask> color: string | null;
<mask> onChange: (color: string) => void;
</s> Restyle the color picker a touch (#920) </s> add showInput: boolean; </s> remove width: 6.25em;
</s> add width: 12ch; /* length of `transparent` + 1 */
margin: 0; </s> add useEffect(() => {
if (onCloseRequest) {
const handler = (e: Event) => {
if (!popoverRef.current?.contains(e.target as Node)) {
onCloseRequest();
}
};
document.addEventListener("pointerdown", handler, false);
return () => document.removeEventListener("pointerdown", handler, false);
}
}, [onCloseRequest]);
</s> remove <div className="color-picker-triangle-shadow"></div>
</s> add <div className="color-picker-triangle color-picker-triangle-shadow"></div> </s> remove <div
className="cover"
onClick={onCloseRequest}
onContextMenu={event => {
event.preventDefault();
if (onCloseRequest) {
onCloseRequest();
}
}}
/>
</s> add </s> remove </div>
</s> add </label>
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ColorPicker.tsx
|
keep keep keep add keep keep keep keep keep keep
|
<mask> color: string | null;
<mask> onChange: (color: string) => void;
<mask> onClose: () => void;
<mask> label: string;
<mask> }) {
<mask> const firstItem = React.useRef<HTMLButtonElement>();
<mask> const activeItem = React.useRef<HTMLButtonElement>();
<mask> const gallery = React.useRef<HTMLDivElement>();
<mask> const colorInput = React.useRef<HTMLInputElement>();
<mask>
</s> Restyle the color picker a touch (#920) </s> add showInput = true, </s> remove const length = gallery!.current!.children.length;
</s> add const length = gallery!.current!.children.length - (showInput ? 1 : 0); </s> add useEffect(() => {
if (onCloseRequest) {
const handler = (e: Event) => {
if (!popoverRef.current?.contains(e.target as Node)) {
onCloseRequest();
}
};
document.addEventListener("pointerdown", handler, false);
return () => document.removeEventListener("pointerdown", handler, false);
}
}, [onCloseRequest]);
</s> remove import React, { useLayoutEffect, useRef } from "react";
</s> add import React, { useLayoutEffect, useRef, useEffect } from "react"; </s> remove <div className="color-input-container">
</s> add <label className="color-input-container"> </s> remove </div>
</s> add </label>
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ColorPicker.tsx
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> gallery!.current!.children,
<mask> activeElement,
<mask> );
<mask> if (index !== -1) {
<mask> const length = gallery!.current!.children.length;
<mask> const nextIndex =
<mask> event.key === KEYS.ARROW_RIGHT
<mask> ? (index + 1) % length
<mask> : event.key === KEYS.ARROW_LEFT
<mask> ? (length + index - 1) % length
</s> Restyle the color picker a touch (#920) </s> add showInput: boolean; </s> remove width: 6.25em;
</s> add width: 12ch; /* length of `transparent` + 1 */
margin: 0; </s> remove style={color ? { backgroundColor: color } : undefined}
</s> add style={
color
? ({ "--swatch-color": color } as React.CSSProperties)
: undefined
} </s> add useEffect(() => {
if (onCloseRequest) {
const handler = (e: Event) => {
if (!popoverRef.current?.contains(e.target as Node)) {
onCloseRequest();
}
};
document.addEventListener("pointerdown", handler, false);
return () => document.removeEventListener("pointerdown", handler, false);
}
}, [onCloseRequest]);
</s> add showInput = true, </s> remove import React, { useLayoutEffect, useRef } from "react";
</s> add import React, { useLayoutEffect, useRef, useEffect } from "react";
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ColorPicker.tsx
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> aria-modal="true"
<mask> aria-label={t("labels.colorPicker")}
<mask> onKeyDown={handleKeyDown}
<mask> >
<mask> <div className="color-picker-triangle-shadow"></div>
<mask> <div className="color-picker-triangle"></div>
<mask> <div className="color-picker-content">
<mask> <div
<mask> className="colors-gallery"
<mask> ref={el => {
</s> Restyle the color picker a touch (#920) </s> remove <div onKeyDown={handleKeyDown}>
</s> add <div onKeyDown={handleKeyDown} className="ExportDialog"> </s> remove <div className="color-input-container">
</s> add <label className="color-input-container"> </s> remove <div className="ExportDialog__actions">
<Stack.Col gap={1}>
</s> add <Stack.Col gap={2} align="center">
<div className="ExportDialog__actions"> </s> remove <div
className="cover"
onClick={onCloseRequest}
onContextMenu={event => {
event.preventDefault();
if (onCloseRequest) {
onCloseRequest();
}
}}
/>
</s> add </s> remove </Stack.Col>
{actionManager.renderAction("changeProjectName")}
<Stack.Col gap={1}>
<div className="ExportDialog__scales">
<Stack.Row gap={2} align="baseline">
{scales.map(s => (
<ToolButton
key={s}
size="s"
type="radio"
icon={`x${s}`}
name="export-canvas-scale"
aria-label={`Scale ${s} x`}
id="export-canvas-scale"
checked={s === scale}
onChange={() => setScale(s)}
/>
))}
</Stack.Row>
</s> add <div className="ExportDialog__name">
{actionManager.renderAction("changeProjectName")} </s> remove style={color ? { backgroundColor: color } : undefined}
</s> add style={
color
? ({ "--swatch-color": color } as React.CSSProperties)
: undefined
}
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ColorPicker.tsx
|
keep keep keep keep replace keep keep keep keep keep
|
<mask>
<mask> React.useImperativeHandle(ref, () => inputRef.current);
<mask>
<mask> return (
<mask> <div className="color-input-container">
<mask> <div className="color-picker-hash">#</div>
<mask> <input
<mask> spellCheck={false}
<mask> className="color-picker-input"
<mask> aria-label={label}
</s> Restyle the color picker a touch (#920) </s> remove <div onKeyDown={handleKeyDown}>
</s> add <div onKeyDown={handleKeyDown} className="ExportDialog"> </s> remove <div className="ExportDialog__actions">
<Stack.Col gap={1}>
</s> add <Stack.Col gap={2} align="center">
<div className="ExportDialog__actions"> </s> add useEffect(() => {
if (onCloseRequest) {
const handler = (e: Event) => {
if (!popoverRef.current?.contains(e.target as Node)) {
onCloseRequest();
}
};
document.addEventListener("pointerdown", handler, false);
return () => document.removeEventListener("pointerdown", handler, false);
}
}, [onCloseRequest]);
</s> remove <div
className="cover"
onClick={onCloseRequest}
onContextMenu={event => {
event.preventDefault();
if (onCloseRequest) {
onCloseRequest();
}
}}
/>
</s> add </s> remove <div className="color-picker-triangle-shadow"></div>
</s> add <div className="color-picker-triangle color-picker-triangle-shadow"></div> </s> remove </Stack.Col>
{actionManager.renderAction("changeProjectName")}
<Stack.Col gap={1}>
<div className="ExportDialog__scales">
<Stack.Row gap={2} align="baseline">
{scales.map(s => (
<ToolButton
key={s}
size="s"
type="radio"
icon={`x${s}`}
name="export-canvas-scale"
aria-label={`Scale ${s} x`}
id="export-canvas-scale"
checked={s === scale}
onChange={() => setScale(s)}
/>
))}
</Stack.Row>
</s> add <div className="ExportDialog__name">
{actionManager.renderAction("changeProjectName")}
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ColorPicker.tsx
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> onPaste={event => onChange(event.clipboardData.getData("text"))}
<mask> onBlur={() => setInnerValue(color)}
<mask> ref={inputRef}
<mask> />
<mask> </div>
<mask> );
<mask> },
<mask> );
<mask>
<mask> export function ColorPicker({
</s> Restyle the color picker a touch (#920) </s> remove {actionManager.renderAction("changeExportBackground")}
{someElementIsSelected && (
<div>
<label>
<input
type="checkbox"
checked={exportSelected}
onChange={event =>
setExportSelected(event.currentTarget.checked)
}
ref={onlySelectedInput}
/>{" "}
{t("labels.onlySelected")}
</label>
</div>
)}
</Stack.Col>
</div>
</s> add <Stack.Row gap={2}>
{scales.map(s => (
<ToolButton
key={s}
size="s"
type="radio"
icon={`x${s}`}
name="export-canvas-scale"
aria-label={`Scale ${s} x`}
id="export-canvas-scale"
checked={s === scale}
onChange={() => setScale(s)}
/>
))}
</Stack.Row>
</div>
{actionManager.renderAction("changeExportBackground")}
{someElementIsSelected && (
<div>
<label>
<input
type="checkbox"
checked={exportSelected}
onChange={event =>
setExportSelected(event.currentTarget.checked)
}
ref={onlySelectedInput}
/>{" "}
{t("labels.onlySelected")}
</label>
</div>
)}
</Stack.Col> </s> remove <div
className="cover"
onClick={onCloseRequest}
onContextMenu={event => {
event.preventDefault();
if (onCloseRequest) {
onCloseRequest();
}
}}
/>
</s> add </s> add useEffect(() => {
if (onCloseRequest) {
const handler = (e: Event) => {
if (!popoverRef.current?.contains(e.target as Node)) {
onCloseRequest();
}
};
document.addEventListener("pointerdown", handler, false);
return () => document.removeEventListener("pointerdown", handler, false);
}
}, [onCloseRequest]);
</s> remove </Stack.Col>
{actionManager.renderAction("changeProjectName")}
<Stack.Col gap={1}>
<div className="ExportDialog__scales">
<Stack.Row gap={2} align="baseline">
{scales.map(s => (
<ToolButton
key={s}
size="s"
type="radio"
icon={`x${s}`}
name="export-canvas-scale"
aria-label={`Scale ${s} x`}
id="export-canvas-scale"
checked={s === scale}
onChange={() => setScale(s)}
/>
))}
</Stack.Row>
</s> add <div className="ExportDialog__name">
{actionManager.renderAction("changeProjectName")} </s> add showInput={false} </s> remove style={color ? { backgroundColor: color } : undefined}
</s> add style={
color
? ({ "--swatch-color": color } as React.CSSProperties)
: undefined
}
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ColorPicker.tsx
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> <div className="color-picker-control-container">
<mask> <button
<mask> className="color-picker-label-swatch"
<mask> aria-label={label}
<mask> style={color ? { backgroundColor: color } : undefined}
<mask> onClick={() => setActive(!isActive)}
<mask> ref={pickerButton}
<mask> />
<mask> <ColorInput
<mask> color={color}
</s> Restyle the color picker a touch (#920) </s> remove const length = gallery!.current!.children.length;
</s> add const length = gallery!.current!.children.length - (showInput ? 1 : 0); </s> remove </Stack.Col>
{actionManager.renderAction("changeProjectName")}
<Stack.Col gap={1}>
<div className="ExportDialog__scales">
<Stack.Row gap={2} align="baseline">
{scales.map(s => (
<ToolButton
key={s}
size="s"
type="radio"
icon={`x${s}`}
name="export-canvas-scale"
aria-label={`Scale ${s} x`}
id="export-canvas-scale"
checked={s === scale}
onChange={() => setScale(s)}
/>
))}
</Stack.Row>
</s> add <div className="ExportDialog__name">
{actionManager.renderAction("changeProjectName")} </s> remove <div className="color-input-container">
</s> add <label className="color-input-container"> </s> remove <div
className="cover"
onClick={onCloseRequest}
onContextMenu={event => {
event.preventDefault();
if (onCloseRequest) {
onCloseRequest();
}
}}
/>
</s> add </s> add showInput={false} </s> remove <div className="color-picker-triangle-shadow"></div>
</s> add <div className="color-picker-triangle color-picker-triangle-shadow"></div>
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ColorPicker.tsx
|
keep add keep keep keep keep keep
|
<mask> }}
<mask> label={label}
<mask> />
<mask> </Popover>
<mask> ) : null}
<mask> </React.Suspense>
<mask> </div>
</s> Restyle the color picker a touch (#920) </s> remove <div
className="cover"
onClick={onCloseRequest}
onContextMenu={event => {
event.preventDefault();
if (onCloseRequest) {
onCloseRequest();
}
}}
/>
</s> add </s> remove style={color ? { backgroundColor: color } : undefined}
</s> add style={
color
? ({ "--swatch-color": color } as React.CSSProperties)
: undefined
} </s> remove {actionManager.renderAction("changeExportBackground")}
{someElementIsSelected && (
<div>
<label>
<input
type="checkbox"
checked={exportSelected}
onChange={event =>
setExportSelected(event.currentTarget.checked)
}
ref={onlySelectedInput}
/>{" "}
{t("labels.onlySelected")}
</label>
</div>
)}
</Stack.Col>
</div>
</s> add <Stack.Row gap={2}>
{scales.map(s => (
<ToolButton
key={s}
size="s"
type="radio"
icon={`x${s}`}
name="export-canvas-scale"
aria-label={`Scale ${s} x`}
id="export-canvas-scale"
checked={s === scale}
onChange={() => setScale(s)}
/>
))}
</Stack.Row>
</div>
{actionManager.renderAction("changeExportBackground")}
{someElementIsSelected && (
<div>
<label>
<input
type="checkbox"
checked={exportSelected}
onChange={event =>
setExportSelected(event.currentTarget.checked)
}
ref={onlySelectedInput}
/>{" "}
{t("labels.onlySelected")}
</label>
</div>
)}
</Stack.Col> </s> remove </div>
</s> add </label> </s> remove </Stack.Col>
{actionManager.renderAction("changeProjectName")}
<Stack.Col gap={1}>
<div className="ExportDialog__scales">
<Stack.Row gap={2} align="baseline">
{scales.map(s => (
<ToolButton
key={s}
size="s"
type="radio"
icon={`x${s}`}
name="export-canvas-scale"
aria-label={`Scale ${s} x`}
id="export-canvas-scale"
checked={s === scale}
onChange={() => setScale(s)}
/>
))}
</Stack.Row>
</s> add <div className="ExportDialog__name">
{actionManager.renderAction("changeProjectName")} </s> add useEffect(() => {
if (onCloseRequest) {
const handler = (e: Event) => {
if (!popoverRef.current?.contains(e.target as Node)) {
onCloseRequest();
}
};
document.addEventListener("pointerdown", handler, false);
return () => document.removeEventListener("pointerdown", handler, false);
}
}, [onCloseRequest]);
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ColorPicker.tsx
|
keep keep keep replace keep keep keep keep keep
|
<mask> @import "../_variables";
<mask>
<mask> .Dialog__title {
<mask> --metric: calc(var(--space-factor) * 4);
<mask> display: grid;
<mask> align-items: center;
<mask> margin-top: 0;
<mask> grid-template-columns: 1fr calc(var(--space-factor) * 7);
<mask> grid-gap: var(--metric);
</s> Restyle the color picker a touch (#920) </s> add .Dialog {
--metric: calc(var(--space-factor) * 4);
--inset-left: #{"max(var(--metric), env(safe-area-inset-left))"};
--inset-right: #{"max(var(--metric), env(safe-area-inset-right))"};
} </s> remove margin: calc(-1 * var(--metric));
</s> add margin: calc(-1 * var(--inset-right));
margin-top: calc(-1 * var(--metric)); </s> add grid-gap: calc(var(--space-factor) * 2); </s> add width: 100%; </s> remove padding: calc(var(--space-factor) * 2) var(--metric);
</s> add padding: calc(var(--space-factor) * 2);
padding-left: var(--inset-left);
padding-right: var(--inset-right); </s> remove display: flex;
</s> add display: grid;
grid-template-columns: auto 1fr;
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/Dialog.scss
|
keep keep add keep keep keep keep keep
|
<mask> }
<mask>
<mask> @media #{$media-query} {
<mask> .Dialog__title {
<mask> grid-template-columns: calc(var(--space-factor) * 7) 1fr calc(
<mask> var(--space-factor) * 7
<mask> );
<mask> position: sticky;
</s> Restyle the color picker a touch (#920) </s> remove --metric: calc(var(--space-factor) * 4);
</s> add </s> remove margin: calc(-1 * var(--metric));
</s> add margin: calc(-1 * var(--inset-right));
margin-top: calc(-1 * var(--metric)); </s> remove .ExportDialog__scales {
display: flex;
align-items: baseline;
justify-content: flex-end;
</s> add .ExportDialog__name {
grid-column: project-name;
margin: auto;
}
@media (max-width: 550px) {
.ExportDialog {
display: flex;
flex-direction: column;
}
.ExportDialog__actions {
flex-direction: column;
align-items: center;
}
.ExportDialog__actions > * {
margin-bottom: calc(var(--space-factor) * 3);
} </s> remove padding: calc(var(--space-factor) * 2) var(--metric);
</s> add padding: calc(var(--space-factor) * 2);
padding-left: var(--inset-left);
padding-right: var(--inset-right); </s> remove .ExportDialog__actions {
flex-direction: column;
}
.ExportDialog__actions > * {
margin-bottom: calc(var(--space-factor) * 3);
}
.ExportDialog__scales {
justify-content: flex-start;
}
</s> add </s> add grid-gap: calc(var(--space-factor) * 2);
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/Dialog.scss
|
keep replace keep replace keep
|
<mask> top: calc(-1 * var(--metric));
<mask> margin: calc(-1 * var(--metric));
<mask> margin-bottom: var(--metric);
<mask> padding: calc(var(--space-factor) * 2) var(--metric);
<mask> background: white;
</s> Restyle the color picker a touch (#920) </s> remove --metric: calc(var(--space-factor) * 4);
</s> add </s> remove .ExportDialog__actions {
flex-direction: column;
}
.ExportDialog__actions > * {
margin-bottom: calc(var(--space-factor) * 3);
}
.ExportDialog__scales {
justify-content: flex-start;
}
</s> add </s> remove .ExportDialog__scales {
display: flex;
align-items: baseline;
justify-content: flex-end;
</s> add .ExportDialog__name {
grid-column: project-name;
margin: auto;
}
@media (max-width: 550px) {
.ExportDialog {
display: flex;
flex-direction: column;
}
.ExportDialog__actions {
flex-direction: column;
align-items: center;
}
.ExportDialog__actions > * {
margin-bottom: calc(var(--space-factor) * 3);
} </s> add .Dialog {
--metric: calc(var(--space-factor) * 4);
--inset-left: #{"max(var(--metric), env(safe-area-inset-left))"};
--inset-right: #{"max(var(--metric), env(safe-area-inset-right))"};
} </s> add grid-gap: calc(var(--space-factor) * 2);
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/Dialog.scss
|
keep keep add keep keep keep keep keep
|
<mask> text-align: center;
<mask> }
<mask> .Dialog .Island {
<mask> height: 100%;
<mask> box-sizing: border-box;
<mask> overflow-y: auto;
<mask> padding-left: #{"max(calc(var(--padding) * var(--space-factor)), env(safe-area-inset-left))"};
<mask> padding-right: #{"max(calc(var(--padding) * var(--space-factor)), env(safe-area-inset-right))"};
</s> Restyle the color picker a touch (#920) </s> add padding-left: #{"max(calc(var(--padding) * var(--space-factor)), env(safe-area-inset-left))"};
padding-right: #{"max(calc(var(--padding) * var(--space-factor)), env(safe-area-inset-right))"};
padding-bottom: #{"max(calc(var(--padding) * var(--space-factor)), env(safe-area-inset-bottom))"}; </s> remove .ExportDialog__actions {
flex-direction: column;
}
.ExportDialog__actions > * {
margin-bottom: calc(var(--space-factor) * 3);
}
.ExportDialog__scales {
justify-content: flex-start;
}
</s> add </s> add .Dialog {
--metric: calc(var(--space-factor) * 4);
--inset-left: #{"max(var(--metric), env(safe-area-inset-left))"};
--inset-right: #{"max(var(--metric), env(safe-area-inset-right))"};
} </s> remove padding: calc(var(--space-factor) * 2) var(--metric);
</s> add padding: calc(var(--space-factor) * 2);
padding-left: var(--inset-left);
padding-right: var(--inset-right); </s> remove .ExportDialog__scales {
display: flex;
align-items: baseline;
justify-content: flex-end;
</s> add .ExportDialog__name {
grid-column: project-name;
margin: auto;
}
@media (max-width: 550px) {
.ExportDialog {
display: flex;
flex-direction: column;
}
.ExportDialog__actions {
flex-direction: column;
align-items: center;
}
.ExportDialog__actions > * {
margin-bottom: calc(var(--space-factor) * 3);
} </s> remove margin: 0px 0.375rem 0.375rem 0px;
</s> add margin: 0;
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/Dialog.scss
|
keep keep keep add keep keep keep keep keep
|
<mask> width: 100vw;
<mask> height: 100%;
<mask> box-sizing: border-box;
<mask> overflow-y: auto;
<mask> }
<mask>
<mask> .Dialog .Modal__close {
<mask> order: -1;
<mask> }
</s> Restyle the color picker a touch (#920) </s> add width: 100vw; </s> remove margin: 0px 0.375rem 0.375rem 0px;
</s> add margin: 0; </s> remove .ExportDialog__actions {
flex-direction: column;
}
.ExportDialog__actions > * {
margin-bottom: calc(var(--space-factor) * 3);
}
.ExportDialog__scales {
justify-content: flex-start;
}
</s> add </s> add position: relative;
overflow: hidden;
background-color: transparent !important;
}
.color-picker-label-swatch::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: var(--swatch-color); </s> add width: 100%; </s> add grid-gap: calc(var(--space-factor) * 2);
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/Dialog.scss
|
keep keep keep add keep keep keep keep keep keep
|
<mask> max-height: 25rem;
<mask> }
<mask>
<mask> .ExportDialog__actions {
<mask> display: flex;
<mask> grid-gap: calc(var(--space-factor) * 2);
<mask> align-items: top;
<mask> justify-content: space-between;
<mask> }
<mask>
</s> Restyle the color picker a touch (#920) </s> add grid-gap: calc(var(--space-factor) * 2); </s> remove flex-wrap: wrap;
</s> add </s> remove .ExportDialog__scales {
display: flex;
align-items: baseline;
justify-content: flex-end;
</s> add .ExportDialog__name {
grid-column: project-name;
margin: auto;
}
@media (max-width: 550px) {
.ExportDialog {
display: flex;
flex-direction: column;
}
.ExportDialog__actions {
flex-direction: column;
align-items: center;
}
.ExportDialog__actions > * {
margin-bottom: calc(var(--space-factor) * 3);
} </s> remove .ExportDialog__actions {
flex-direction: column;
}
.ExportDialog__actions > * {
margin-bottom: calc(var(--space-factor) * 3);
}
.ExportDialog__scales {
justify-content: flex-start;
}
</s> add </s> remove --metric: calc(var(--space-factor) * 4);
</s> add </s> remove padding: 1rem 0.5rem 0.5rem 1rem;
</s> add padding: 0.5rem 0.5rem;
display: grid;
grid-template-columns: repeat(5, auto);
grid-gap: 0.5rem;
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ExportDialog.scss
|
keep add keep keep keep keep keep
|
<mask> width: 100%;
<mask> display: flex;
<mask> align-items: top;
<mask> justify-content: space-between;
<mask> }
<mask>
<mask> .ExportDialog__name {
</s> Restyle the color picker a touch (#920) </s> add width: 100%; </s> remove flex-wrap: wrap;
</s> add </s> remove .ExportDialog__scales {
display: flex;
align-items: baseline;
justify-content: flex-end;
</s> add .ExportDialog__name {
grid-column: project-name;
margin: auto;
}
@media (max-width: 550px) {
.ExportDialog {
display: flex;
flex-direction: column;
}
.ExportDialog__actions {
flex-direction: column;
align-items: center;
}
.ExportDialog__actions > * {
margin-bottom: calc(var(--space-factor) * 3);
} </s> remove display: flex;
</s> add display: grid;
grid-template-columns: auto 1fr; </s> remove .color-picker-triangle-shadow {
width: 0px;
height: 0px;
border-style: solid;
border-width: 0px 9px 10px;
border-color: transparent transparent rgba(0, 0, 0, 0.1);
position: absolute;
top: -11px;
left: 12px;
}
</s> add </s> add position: relative;
overflow: hidden;
background-color: transparent !important;
}
.color-picker-label-swatch::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: var(--swatch-color);
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ExportDialog.scss
|
keep keep keep keep replace keep keep replace replace replace replace keep
|
<mask> .ExportDialog__actions {
<mask> display: flex;
<mask> align-items: top;
<mask> justify-content: space-between;
<mask> flex-wrap: wrap;
<mask> }
<mask>
<mask> .ExportDialog__scales {
<mask> display: flex;
<mask> align-items: baseline;
<mask> justify-content: flex-end;
<mask> }
</s> Restyle the color picker a touch (#920) </s> add width: 100%; </s> add grid-gap: calc(var(--space-factor) * 2); </s> remove .ExportDialog__actions {
flex-direction: column;
}
.ExportDialog__actions > * {
margin-bottom: calc(var(--space-factor) * 3);
}
.ExportDialog__scales {
justify-content: flex-start;
}
</s> add </s> remove padding: 1rem 0.5rem 0.5rem 1rem;
</s> add padding: 0.5rem 0.5rem;
display: grid;
grid-template-columns: repeat(5, auto);
grid-gap: 0.5rem; </s> remove display: flex;
</s> add display: grid;
grid-template-columns: auto 1fr;
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ExportDialog.scss
|
keep keep keep keep replace replace replace replace replace replace replace replace replace keep
|
<mask> }
<mask> .ExportDialog__dialog .Island {
<mask> overflow-y: auto;
<mask> }
<mask> .ExportDialog__actions {
<mask> flex-direction: column;
<mask> }
<mask> .ExportDialog__actions > * {
<mask> margin-bottom: calc(var(--space-factor) * 3);
<mask> }
<mask> .ExportDialog__scales {
<mask> justify-content: flex-start;
<mask> }
<mask> }
</s> Restyle the color picker a touch (#920) </s> remove .ExportDialog__scales {
display: flex;
align-items: baseline;
justify-content: flex-end;
</s> add .ExportDialog__name {
grid-column: project-name;
margin: auto;
}
@media (max-width: 550px) {
.ExportDialog {
display: flex;
flex-direction: column;
}
.ExportDialog__actions {
flex-direction: column;
align-items: center;
}
.ExportDialog__actions > * {
margin-bottom: calc(var(--space-factor) * 3);
} </s> add width: 100%; </s> remove flex-wrap: wrap;
</s> add </s> add width: 100vw; </s> add padding-left: #{"max(calc(var(--padding) * var(--space-factor)), env(safe-area-inset-left))"};
padding-right: #{"max(calc(var(--padding) * var(--space-factor)), env(safe-area-inset-right))"};
padding-bottom: #{"max(calc(var(--padding) * var(--space-factor)), env(safe-area-inset-bottom))"}; </s> add .Dialog {
--metric: calc(var(--space-factor) * 4);
--inset-left: #{"max(var(--metric), env(safe-area-inset-left))"};
--inset-right: #{"max(var(--metric), env(safe-area-inset-right))"};
}
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ExportDialog.scss
|
keep keep keep keep replace keep replace replace keep
|
<mask> }
<mask> }
<mask>
<mask> return (
<mask> <div onKeyDown={handleKeyDown}>
<mask> <div className="ExportDialog__preview" ref={previewRef}></div>
<mask> <div className="ExportDialog__actions">
<mask> <Stack.Col gap={1}>
<mask> <Stack.Row gap={2}>
</s> Restyle the color picker a touch (#920) </s> remove </Stack.Col>
{actionManager.renderAction("changeProjectName")}
<Stack.Col gap={1}>
<div className="ExportDialog__scales">
<Stack.Row gap={2} align="baseline">
{scales.map(s => (
<ToolButton
key={s}
size="s"
type="radio"
icon={`x${s}`}
name="export-canvas-scale"
aria-label={`Scale ${s} x`}
id="export-canvas-scale"
checked={s === scale}
onChange={() => setScale(s)}
/>
))}
</Stack.Row>
</s> add <div className="ExportDialog__name">
{actionManager.renderAction("changeProjectName")} </s> remove <div className="color-input-container">
</s> add <label className="color-input-container"> </s> remove <div
className="cover"
onClick={onCloseRequest}
onContextMenu={event => {
event.preventDefault();
if (onCloseRequest) {
onCloseRequest();
}
}}
/>
</s> add </s> add useEffect(() => {
if (onCloseRequest) {
const handler = (e: Event) => {
if (!popoverRef.current?.contains(e.target as Node)) {
onCloseRequest();
}
};
document.addEventListener("pointerdown", handler, false);
return () => document.removeEventListener("pointerdown", handler, false);
}
}, [onCloseRequest]);
</s> remove <div className="color-picker-triangle-shadow"></div>
</s> add <div className="color-picker-triangle color-picker-triangle-shadow"></div>
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ExportDialog.tsx
|
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep
|
<mask> aria-label={t("buttons.getShareableLink")}
<mask> onClick={() => onExportToBackend(exportedElements)}
<mask> />
<mask> </Stack.Row>
<mask> </Stack.Col>
<mask> {actionManager.renderAction("changeProjectName")}
<mask> <Stack.Col gap={1}>
<mask> <div className="ExportDialog__scales">
<mask> <Stack.Row gap={2} align="baseline">
<mask> {scales.map(s => (
<mask> <ToolButton
<mask> key={s}
<mask> size="s"
<mask> type="radio"
<mask> icon={`x${s}`}
<mask> name="export-canvas-scale"
<mask> aria-label={`Scale ${s} x`}
<mask> id="export-canvas-scale"
<mask> checked={s === scale}
<mask> onChange={() => setScale(s)}
<mask> />
<mask> ))}
<mask> </Stack.Row>
<mask> </div>
<mask> {actionManager.renderAction("changeExportBackground")}
<mask> {someElementIsSelected && (
<mask> <div>
<mask> <label>
<mask> <input
<mask> type="checkbox"
<mask> checked={exportSelected}
<mask> onChange={event =>
<mask> setExportSelected(event.currentTarget.checked)
<mask> }
<mask> ref={onlySelectedInput}
<mask> />{" "}
<mask> {t("labels.onlySelected")}
<mask> </label>
<mask> </div>
<mask> )}
<mask> </Stack.Col>
<mask> </div>
<mask> </div>
<mask> );
<mask> }
</s> Restyle the color picker a touch (#920) </s> remove </div>
</s> add </label> </s> remove <div
className="cover"
onClick={onCloseRequest}
onContextMenu={event => {
event.preventDefault();
if (onCloseRequest) {
onCloseRequest();
}
}}
/>
</s> add </s> remove <div className="ExportDialog__actions">
<Stack.Col gap={1}>
</s> add <Stack.Col gap={2} align="center">
<div className="ExportDialog__actions"> </s> remove <div onKeyDown={handleKeyDown}>
</s> add <div onKeyDown={handleKeyDown} className="ExportDialog"> </s> add useEffect(() => {
if (onCloseRequest) {
const handler = (e: Event) => {
if (!popoverRef.current?.contains(e.target as Node)) {
onCloseRequest();
}
};
document.addEventListener("pointerdown", handler, false);
return () => document.removeEventListener("pointerdown", handler, false);
}
}, [onCloseRequest]);
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ExportDialog.tsx
|
replace keep keep keep keep keep
|
<mask> import React, { useLayoutEffect, useRef } from "react";
<mask> import "./Popover.css";
<mask>
<mask> type Props = {
<mask> top?: number;
<mask> left?: number;
</s> Restyle the color picker a touch (#920) </s> add useEffect(() => {
if (onCloseRequest) {
const handler = (e: Event) => {
if (!popoverRef.current?.contains(e.target as Node)) {
onCloseRequest();
}
};
document.addEventListener("pointerdown", handler, false);
return () => document.removeEventListener("pointerdown", handler, false);
}
}, [onCloseRequest]);
</s> add showInput: boolean; </s> remove .ExportDialog__actions {
flex-direction: column;
}
.ExportDialog__actions > * {
margin-bottom: calc(var(--space-factor) * 3);
}
.ExportDialog__scales {
justify-content: flex-start;
}
</s> add </s> remove .ExportDialog__scales {
display: flex;
align-items: baseline;
justify-content: flex-end;
</s> add .ExportDialog__name {
grid-column: project-name;
margin: auto;
}
@media (max-width: 550px) {
.ExportDialog {
display: flex;
flex-direction: column;
}
.ExportDialog__actions {
flex-direction: column;
align-items: center;
}
.ExportDialog__actions > * {
margin-bottom: calc(var(--space-factor) * 3);
} </s> add showInput = true, </s> remove const length = gallery!.current!.children.length;
</s> add const length = gallery!.current!.children.length - (showInput ? 1 : 0);
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/Popover.tsx
|
keep keep keep add keep keep keep keep keep keep
|
<mask> }
<mask> }
<mask> }, [fitInViewport]);
<mask>
<mask> return (
<mask> <div className="popover" style={{ top: top, left: left }} ref={popoverRef}>
<mask> {children}
<mask> </div>
<mask> );
<mask> }
</s> Restyle the color picker a touch (#920) </s> remove <div
className="cover"
onClick={onCloseRequest}
onContextMenu={event => {
event.preventDefault();
if (onCloseRequest) {
onCloseRequest();
}
}}
/>
</s> add </s> remove <div onKeyDown={handleKeyDown}>
</s> add <div onKeyDown={handleKeyDown} className="ExportDialog"> </s> add }
.color-picker-transparent,
.color-picker-label-swatch { </s> remove {actionManager.renderAction("changeExportBackground")}
{someElementIsSelected && (
<div>
<label>
<input
type="checkbox"
checked={exportSelected}
onChange={event =>
setExportSelected(event.currentTarget.checked)
}
ref={onlySelectedInput}
/>{" "}
{t("labels.onlySelected")}
</label>
</div>
)}
</Stack.Col>
</div>
</s> add <Stack.Row gap={2}>
{scales.map(s => (
<ToolButton
key={s}
size="s"
type="radio"
icon={`x${s}`}
name="export-canvas-scale"
aria-label={`Scale ${s} x`}
id="export-canvas-scale"
checked={s === scale}
onChange={() => setScale(s)}
/>
))}
</Stack.Row>
</div>
{actionManager.renderAction("changeExportBackground")}
{someElementIsSelected && (
<div>
<label>
<input
type="checkbox"
checked={exportSelected}
onChange={event =>
setExportSelected(event.currentTarget.checked)
}
ref={onlySelectedInput}
/>{" "}
{t("labels.onlySelected")}
</label>
</div>
)}
</Stack.Col> </s> remove </div>
</s> add </label> </s> remove <div className="color-input-container">
</s> add <label className="color-input-container">
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/Popover.tsx
|
keep keep keep keep replace replace replace replace replace replace replace replace replace replace keep keep keep keep
|
<mask> }, [fitInViewport]);
<mask>
<mask> return (
<mask> <div className="popover" style={{ top: top, left: left }} ref={popoverRef}>
<mask> <div
<mask> className="cover"
<mask> onClick={onCloseRequest}
<mask> onContextMenu={event => {
<mask> event.preventDefault();
<mask> if (onCloseRequest) {
<mask> onCloseRequest();
<mask> }
<mask> }}
<mask> />
<mask> {children}
<mask> </div>
<mask> );
<mask> }
</s> Restyle the color picker a touch (#920) </s> add useEffect(() => {
if (onCloseRequest) {
const handler = (e: Event) => {
if (!popoverRef.current?.contains(e.target as Node)) {
onCloseRequest();
}
};
document.addEventListener("pointerdown", handler, false);
return () => document.removeEventListener("pointerdown", handler, false);
}
}, [onCloseRequest]);
</s> remove <div onKeyDown={handleKeyDown}>
</s> add <div onKeyDown={handleKeyDown} className="ExportDialog"> </s> add showInput={false} </s> remove </div>
</s> add </label> </s> add }
.color-picker-transparent,
.color-picker-label-swatch { </s> remove <div className="color-input-container">
</s> add <label className="color-input-container">
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/Popover.tsx
|
keep keep keep keep replace replace replace keep keep keep keep keep
|
<mask> .ProjectName {
<mask> display: inline-block;
<mask> cursor: pointer;
<mask> border: 1.5px solid #eee;
<mask> height: 2.5rem;
<mask> line-height: 2.5rem;
<mask> padding: 0 0.5rem;
<mask> white-space: nowrap;
<mask> border-radius: var(--space-factor);
<mask> }
<mask>
<mask> .ProjectName:hover {
</s> Restyle the color picker a touch (#920) </s> remove margin: 0px 0.375rem 0.375rem 0px;
</s> add margin: 0; </s> remove padding: 1rem 0.5rem 0.5rem 1rem;
</s> add padding: 0.5rem 0.5rem;
display: grid;
grid-template-columns: repeat(5, auto);
grid-gap: 0.5rem; </s> add .color-picker-triangle-shadow {
border-color: transparent transparent rgba(0, 0, 0, 0.1);
top: -11px;
}
</s> remove position: relative;
</s> add position: absolute;
left: -5.5px; </s> remove .colors-gallery {
display: flex;
flex-wrap: wrap;
</s> add .color-picker-content .color-input-container {
grid-column: 1 / span 5; </s> remove width: 205px;
</s> add
|
https://github.com/excalidraw/excalidraw/commit/e44801123a1d94812c29941277c53a211bb1c8b0
|
src/components/ProjectName.css
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "cannotRestoreFromImage": "",
<mask> "invalidSceneUrl": "",
<mask> "resetLibrary": "",
<mask> "removeItemsFromsLibrary": "",
<mask> "invalidEncryptionKey": ""
<mask> },
<mask> "errors": {
<mask> "unsupportedFileType": "",
<mask> "imageInsertError": "",
<mask> "fileTooBig": "",
</s> chore: Update translations from Crowdin (#6191) </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "canvasPanning": "",
</s> add "canvasPanning": "Oihala mugitzeko, eutsi saguaren gurpila edo zuriune-barra arrastatzean, edo erabili esku tresna", </s> remove "invalidEncryptionKey": "Sandi enkripsi harus 22 karakter. Kolaborasi langsung dinonaktifkan."
</s> add "invalidEncryptionKey": "Sandi enkripsi harus 22 karakter. Kolaborasi langsung dinonaktifkan.",
"collabOfflineWarning": ""
|
https://github.com/excalidraw/excalidraw/commit/e4506be3e8ef07190c8fd28ebd2750ec211d04de
|
src/locales/cs-CZ.json
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "cannotRestoreFromImage": "",
<mask> "invalidSceneUrl": "",
<mask> "resetLibrary": "",
<mask> "removeItemsFromsLibrary": "",
<mask> "invalidEncryptionKey": ""
<mask> },
<mask> "errors": {
<mask> "unsupportedFileType": "",
<mask> "imageInsertError": "",
<mask> "fileTooBig": "",
</s> chore: Update translations from Crowdin (#6191)
|
https://github.com/excalidraw/excalidraw/commit/e4506be3e8ef07190c8fd28ebd2750ec211d04de
|
src/locales/da-DK.json
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "cannotRestoreFromImage": "Ezin izan da eszena leheneratu irudi fitxategi honetatik",
<mask> "invalidSceneUrl": "Ezin izan da eszena inportatu emandako URLtik. Gaizki eratuta dago edo ez du baliozko Excalidraw JSON daturik.",
<mask> "resetLibrary": "Honek zure liburutegia garbituko du. Ziur zaude?",
<mask> "removeItemsFromsLibrary": "Liburutegitik {{count}} elementu ezabatu?",
<mask> "invalidEncryptionKey": "Enkriptazio-gakoak 22 karaktere izan behar ditu. Zuzeneko lankidetza desgaituta dago."
<mask> },
<mask> "errors": {
<mask> "unsupportedFileType": "Onartu gabeko fitxategi mota.",
<mask> "imageInsertError": "Ezin izan da irudia txertatu. Saiatu berriro geroago...",
<mask> "fileTooBig": "Fitxategia handiegia da. Onartutako gehienezko tamaina {{maxSize}} da.",
</s> chore: Update translations from Crowdin (#6191) </s> remove "firefox_clipboard_write": ""
</s> add "firefox_clipboard_write": "Ezaugarri hau \"dom.events.asyncClipboard.clipboardItem\" marka \"true\" gisa ezarrita gaitu daiteke. Firefox-en arakatzailearen banderak aldatzeko, bisitatu \"about:config\" orrialdera." </s> remove "invalidEncryptionKey": "Sandi enkripsi harus 22 karakter. Kolaborasi langsung dinonaktifkan."
</s> add "invalidEncryptionKey": "Sandi enkripsi harus 22 karakter. Kolaborasi langsung dinonaktifkan.",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": ""
|
https://github.com/excalidraw/excalidraw/commit/e4506be3e8ef07190c8fd28ebd2750ec211d04de
|
src/locales/eu-ES.json
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "lock": "Mantendu aktibo hautatutako tresna marraztu ondoren",
<mask> "penMode": "Luma modua - ukipena saihestu",
<mask> "link": "Gehitu / Eguneratu esteka hautatutako forma baterako",
<mask> "eraser": "Borragoma",
<mask> "hand": ""
<mask> },
<mask> "headings": {
<mask> "canvasActions": "Canvas ekintzak",
<mask> "selectedShapeActions": "Hautatutako formaren ekintzak",
<mask> "shapes": "Formak"
</s> chore: Update translations from Crowdin (#6191) </s> remove "canvasPanning": "",
</s> add "canvasPanning": "Oihala mugitzeko, eutsi saguaren gurpila edo zuriune-barra arrastatzean, edo erabili esku tresna", </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": ""
|
https://github.com/excalidraw/excalidraw/commit/e4506be3e8ef07190c8fd28ebd2750ec211d04de
|
src/locales/eu-ES.json
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "selectedShapeActions": "Hautatutako formaren ekintzak",
<mask> "shapes": "Formak"
<mask> },
<mask> "hints": {
<mask> "canvasPanning": "",
<mask> "linearElement": "Egin klik hainbat puntu hasteko, arrastatu lerro bakarrerako",
<mask> "freeDraw": "Egin klik eta arrastatu, askatu amaitutakoan",
<mask> "text": "Aholkua: testua gehitu dezakezu edozein lekutan klik bikoitza eginez hautapen tresnarekin",
<mask> "text_selected": "Egin klik bikoitza edo sakatu SARTU testua editatzeko",
<mask> "text_editing": "Sakatu Esc edo Ctrl+SARTU editatzen amaitzeko",
</s> chore: Update translations from Crowdin (#6191) </s> remove "hand": ""
</s> add "hand": "Eskua (panoratze tresna)" </s> remove "firefox_clipboard_write": ""
</s> add "firefox_clipboard_write": "Ezaugarri hau \"dom.events.asyncClipboard.clipboardItem\" marka \"true\" gisa ezarrita gaitu daiteke. Firefox-en arakatzailearen banderak aldatzeko, bisitatu \"about:config\" orrialdera." </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": ""
|
https://github.com/excalidraw/excalidraw/commit/e4506be3e8ef07190c8fd28ebd2750ec211d04de
|
src/locales/eu-ES.json
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "publishLibrary": "Argitaratu zure liburutegia",
<mask> "bindTextToElement": "Sakatu Sartu testua gehitzeko",
<mask> "deepBoxSelect": "Eutsi Ctrl edo Cmd sakatuta aukeraketa sakona egiteko eta arrastatzea saihesteko",
<mask> "eraserRevert": "Eduki Alt sakatuta ezabatzeko markatutako elementuak leheneratzeko",
<mask> "firefox_clipboard_write": ""
<mask> },
<mask> "canvasError": {
<mask> "cannotShowPreview": "Ezin da oihala aurreikusi",
<mask> "canvasTooBig": "Agian oihala handiegia da.",
<mask> "canvasTooBigTip": "Aholkua: saiatu urrunen dauden elementuak pixka bat hurbiltzen."
</s> chore: Update translations from Crowdin (#6191) </s> remove "canvasPanning": "",
</s> add "canvasPanning": "Oihala mugitzeko, eutsi saguaren gurpila edo zuriune-barra arrastatzean, edo erabili esku tresna", </s> remove "invalidEncryptionKey": "Enkriptazio-gakoak 22 karaktere izan behar ditu. Zuzeneko lankidetza desgaituta dago."
</s> add "invalidEncryptionKey": "Enkriptazio-gakoak 22 karaktere izan behar ditu. Zuzeneko lankidetza desgaituta dago.",
"collabOfflineWarning": "Ez dago Interneteko konexiorik.\nZure aldaketak ez dira gordeko!" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": ""
|
https://github.com/excalidraw/excalidraw/commit/e4506be3e8ef07190c8fd28ebd2750ec211d04de
|
src/locales/eu-ES.json
|
keep keep keep keep replace keep keep keep keep keep
|
<mask> "cannotRestoreFromImage": "Pemandangan tidak dapat dipulihkan dari file gambar ini",
<mask> "invalidSceneUrl": "Tidak dapat impor pemandangan dari URL. Kemungkinan URL itu rusak atau tidak berisi data JSON Excalidraw yang valid.",
<mask> "resetLibrary": "Ini akan menghapus pustaka Anda. Anda yakin?",
<mask> "removeItemsFromsLibrary": "Hapus {{count}} item dari pustaka?",
<mask> "invalidEncryptionKey": "Sandi enkripsi harus 22 karakter. Kolaborasi langsung dinonaktifkan."
<mask> },
<mask> "errors": {
<mask> "unsupportedFileType": "Tipe file tidak didukung.",
<mask> "imageInsertError": "Tidak dapat menyisipkan gambar. Coba lagi nanti...",
<mask> "fileTooBig": "File terlalu besar. Ukuran maksimum yang dibolehkan {{maxSize}}.",
</s> chore: Update translations from Crowdin (#6191) </s> remove "invalidEncryptionKey": "Enkriptazio-gakoak 22 karaktere izan behar ditu. Zuzeneko lankidetza desgaituta dago."
</s> add "invalidEncryptionKey": "Enkriptazio-gakoak 22 karaktere izan behar ditu. Zuzeneko lankidetza desgaituta dago.",
"collabOfflineWarning": "Ez dago Interneteko konexiorik.\nZure aldaketak ez dira gordeko!" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": "" </s> remove "invalidEncryptionKey": ""
</s> add "invalidEncryptionKey": "",
"collabOfflineWarning": ""
|
https://github.com/excalidraw/excalidraw/commit/e4506be3e8ef07190c8fd28ebd2750ec211d04de
|
src/locales/id-ID.json
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.