Remove invisibly small elements on scene load (#754)
This commit is contained in:
parent
fa12125db0
commit
ad4ad238ef
@ -11,7 +11,11 @@ import { ExportType } from "./types";
|
|||||||
import { exportToCanvas, exportToSvg } from "./export";
|
import { exportToCanvas, exportToSvg } from "./export";
|
||||||
import nanoid from "nanoid";
|
import nanoid from "nanoid";
|
||||||
import { fileOpen, fileSave } from "browser-nativefs";
|
import { fileOpen, fileSave } from "browser-nativefs";
|
||||||
import { getCommonBounds, normalizeDimensions } from "../element";
|
import {
|
||||||
|
getCommonBounds,
|
||||||
|
normalizeDimensions,
|
||||||
|
isInvisiblySmallElement,
|
||||||
|
} from "../element";
|
||||||
|
|
||||||
import { Point } from "roughjs/bin/geometry";
|
import { Point } from "roughjs/bin/geometry";
|
||||||
import { t } from "../i18n";
|
import { t } from "../i18n";
|
||||||
@ -334,7 +338,9 @@ function restore(
|
|||||||
savedState: AppState | null,
|
savedState: AppState | null,
|
||||||
opts?: { scrollToContent: boolean },
|
opts?: { scrollToContent: boolean },
|
||||||
): DataState {
|
): DataState {
|
||||||
const elements = savedElements.map(element => {
|
const elements = savedElements
|
||||||
|
.filter(el => !isInvisiblySmallElement(el))
|
||||||
|
.map(element => {
|
||||||
let points: Point[] = [];
|
let points: Point[] = [];
|
||||||
if (element.type === "arrow") {
|
if (element.type === "arrow") {
|
||||||
if (Array.isArray(element.points)) {
|
if (Array.isArray(element.points)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user