rename isVisibleElement -> isElementInViewport

This commit is contained in:
dwelle 2023-08-06 13:48:09 +02:00
parent dbaa13ab97
commit 23ef690222
3 changed files with 6 additions and 6 deletions

View File

@ -189,7 +189,7 @@ import {
isArrowKey,
KEYS,
} from "../keys";
import { isVisibleElement } from "../element/sizeHelpers";
import { isElementInViewport } from "../element/sizeHelpers";
import {
distance2d,
getCornerRadius,
@ -800,7 +800,7 @@ class App extends React.Component<AppProps, AppState> {
this.state,
);
const embedLink = getEmbedLink(toValidURL(el.link || ""));
const isVisible = isVisibleElement(
const isVisible = isElementInViewport(
el,
normalizedWidth,
normalizedHeight,
@ -963,7 +963,7 @@ class App extends React.Component<AppProps, AppState> {
return this.scene.getNonDeletedFrames().map((f, index) => {
if (
!this.canvas ||
!isVisibleElement(
!isElementInViewport(
f,
this.canvas.width / window.devicePixelRatio,
this.canvas.height / window.devicePixelRatio,

View File

@ -15,7 +15,7 @@ export const isInvisiblySmallElement = (
return element.width === 0 && element.height === 0;
};
export const isVisibleElement = (
export const isElementInViewport = (
element: ExcalidrawElement,
width: number,
height: number,

View File

@ -1,4 +1,4 @@
import { isVisibleElement } from "../element/sizeHelpers";
import { isElementInViewport } from "../element/sizeHelpers";
import { isImageElement } from "../element/typeChecks";
import { NonDeletedExcalidrawElement } from "../element/types";
import { AppState } from "../types";
@ -33,7 +33,7 @@ export class Renderer {
width: AppState["width"];
}): readonly NonDeletedExcalidrawElement[] => {
return elements.filter((element) =>
isVisibleElement(element, width, height, {
isElementInViewport(element, width, height, {
zoom,
offsetLeft,
offsetTop,