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

View File

@ -15,7 +15,7 @@ export const isInvisiblySmallElement = (
return element.width === 0 && element.height === 0; return element.width === 0 && element.height === 0;
}; };
export const isVisibleElement = ( export const isElementInViewport = (
element: ExcalidrawElement, element: ExcalidrawElement,
width: number, width: number,
height: 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 { isImageElement } from "../element/typeChecks";
import { NonDeletedExcalidrawElement } from "../element/types"; import { NonDeletedExcalidrawElement } from "../element/types";
import { AppState } from "../types"; import { AppState } from "../types";
@ -33,7 +33,7 @@ export class Renderer {
width: AppState["width"]; width: AppState["width"];
}): readonly NonDeletedExcalidrawElement[] => { }): readonly NonDeletedExcalidrawElement[] => {
return elements.filter((element) => return elements.filter((element) =>
isVisibleElement(element, width, height, { isElementInViewport(element, width, height, {
zoom, zoom,
offsetLeft, offsetLeft,
offsetTop, offsetTop,