mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Multi Point Lines (based on Multi Point Arrows) (#660)
* Enable multi points in lines * Stop retrieving arrow points for lines * Migrate lines to new spec during load * Clean up and refactor some code - Normalize shape dimensions during load - Rename getArrowAbsoluteBounds * Fix linter issues
This commit is contained in:
parent
f70bd0081c
commit
dab35c9033
9 changed files with 102 additions and 178 deletions
|
@ -7,7 +7,7 @@ import { ExportType, PreviousScene } from "./types";
|
|||
import { exportToCanvas, exportToSvg } from "./export";
|
||||
import nanoid from "nanoid";
|
||||
import { fileOpen, fileSave } from "browser-nativefs";
|
||||
import { getCommonBounds } from "../element";
|
||||
import { getCommonBounds, normalizeDimensions } from "../element";
|
||||
|
||||
import { Point } from "roughjs/bin/geometry";
|
||||
import { t } from "../i18n";
|
||||
|
@ -291,6 +291,19 @@ function restore(
|
|||
[element.width, element.height],
|
||||
];
|
||||
}
|
||||
} else if (element.type === "line") {
|
||||
// old spec, pre-arrows
|
||||
// old spec, post-arrows
|
||||
if (!Array.isArray(element.points) || element.points.length === 0) {
|
||||
points = [
|
||||
[0, 0],
|
||||
[element.width, element.height],
|
||||
];
|
||||
} else {
|
||||
points = element.points;
|
||||
}
|
||||
} else {
|
||||
normalizeDimensions(element);
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue