Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lightningjs/renderer

Package Overview
Dependencies
Maintainers
0
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lightningjs/renderer - npm Package Compare versions

Comparing version 2.1.0 to 2.1.1

3

dist/src/core/CoreNode.d.ts

@@ -623,2 +623,3 @@ import type { TextureOptions } from './CoreTextureManager.js';

updateType: UpdateType;
childUpdateType: UpdateType;
globalTransform?: Matrix3d;

@@ -669,2 +670,3 @@ scaleRotateTransform?: Matrix3d;

createPreloadBounds(strictBound: Bound): Bound;
updateBoundingRect(): void;
createRenderBounds(): void;

@@ -680,3 +682,2 @@ updateRenderState(): void;

calculateRenderCoords(): void;
updateBoundingRect(): void;
/**

@@ -683,0 +684,0 @@ * This function calculates the clipping rectangle for a node.

@@ -21,3 +21,3 @@ /*

import { EventEmitter } from '../common/EventEmitter.js';
import { copyRect, intersectRect, createBound, boundInsideBound, } from './lib/utils.js';
import { copyRect, intersectRect, createBound, boundInsideBound, boundLargeThanBound, } from './lib/utils.js';
import { Matrix3d } from './lib/Matrix3d.js';

@@ -165,2 +165,3 @@ import { RenderCoords } from './lib/RenderCoords.js';

updateType = UpdateType.All;
childUpdateType = UpdateType.None;
globalTransform;

@@ -296,3 +297,3 @@ scaleRotateTransform;

const parent = this.props.parent;
if (parent && !(parent.updateType & UpdateType.Children)) {
if (parent !== null && !(parent.updateType & UpdateType.Children)) {
parent.setUpdateType(UpdateType.Children);

@@ -383,3 +384,2 @@ }

const parent = this.props.parent;
let childUpdateType = UpdateType.None;
if (this.updateType & UpdateType.ParentRenderTexture) {

@@ -416,3 +416,3 @@ let p = this.parent;

}
childUpdateType |= UpdateType.Global;
this.childUpdateType |= UpdateType.Global;
}

@@ -432,3 +432,2 @@ if (this.updateType & UpdateType.RenderBounds) {

if (this.renderState === CoreNodeRenderState.OutOfBounds) {
this.updateType = 0;
return;

@@ -439,4 +438,4 @@ }

this.setUpdateType(UpdateType.Children);
childUpdateType |= UpdateType.Clipping;
childUpdateType |= UpdateType.RenderBounds;
this.childUpdateType |= UpdateType.Clipping;
this.childUpdateType |= UpdateType.RenderBounds;
}

@@ -453,3 +452,3 @@ if (this.updateType & UpdateType.WorldAlpha) {

UpdateType.IsRenderable);
childUpdateType |= UpdateType.WorldAlpha;
this.childUpdateType |= UpdateType.WorldAlpha;
}

@@ -482,11 +481,13 @@ if (this.updateType & UpdateType.PremultipliedColors) {

this.rtt === false) {
this.children.forEach((child) => {
// Trigger the depenedent update types on the child
child.setUpdateType(childUpdateType);
// If child has no updates, skip
for (let i = 0; i < this.children.length; i++) {
const child = this.children[i];
if (child === undefined) {
continue;
}
child.setUpdateType(this.childUpdateType);
if (child.updateType === 0) {
return;
continue;
}
child.update(delta, this.clippingRect);
});
}
}

@@ -501,2 +502,3 @@ // Sorting children MUST happen after children have been updated so

this.updateType = 0;
this.childUpdateType = 0;
}

@@ -558,2 +560,11 @@ //check if CoreNode is renderable based on props

}
// check if we're larger then our parent, we're definitely in the viewport
if (boundLargeThanBound(this.renderBound, this.strictBound)) {
return CoreNodeRenderState.InViewport;
}
// check if we dont have dimensions, take our parent's render state
if (this.parent !== null &&
(this.props.width === 0 || this.props.height === 0)) {
return this.parent.renderState;
}
return CoreNodeRenderState.OutOfBounds;

@@ -565,2 +576,16 @@ }

}
updateBoundingRect() {
const { renderCoords, globalTransform: transform } = this;
assertTruthy(transform);
assertTruthy(renderCoords);
const { tb, tc } = transform;
const { x1, y1, x3, y3 } = renderCoords;
if (tb === 0 || tc === 0) {
this.renderBound = createBound(x1, y1, x3, y3, this.renderBound);
}
else {
const { x2, x4, y2, y4 } = renderCoords;
this.renderBound = createBound(Math.min(x1, x2, x3, x4), Math.min(y1, y2, y3, y4), Math.max(x1, x2, x3, x4), Math.max(y1, y2, y3, y4), this.renderBound);
}
}
createRenderBounds() {

@@ -659,16 +684,2 @@ assertTruthy(this.stage);

}
updateBoundingRect() {
const { renderCoords, globalTransform: transform } = this;
assertTruthy(transform);
assertTruthy(renderCoords);
const { tb, tc } = transform;
const { x1, y1, x3, y3 } = renderCoords;
if (tb === 0 || tc === 0) {
this.renderBound = createBound(x1, y1, x3, y3, this.renderBound);
}
else {
const { x2, x4, y2, y4 } = renderCoords;
this.renderBound = createBound(Math.min(x1, x2, x3, x4), Math.min(y1, y2, y3, y4), Math.max(x1, x2, x3, x4), Math.max(y1, y2, y3, y4), this.renderBound);
}
}
/**

@@ -962,3 +973,6 @@ * This function calculates the clipping rectangle for a node.

this.props.alpha = value;
this.setUpdateType(UpdateType.PremultipliedColors | UpdateType.WorldAlpha);
this.setUpdateType(UpdateType.PremultipliedColors |
UpdateType.WorldAlpha |
UpdateType.Children);
this.childUpdateType |= UpdateType.Global;
}

@@ -977,2 +991,3 @@ get autosize() {

this.setUpdateType(UpdateType.Clipping | UpdateType.RenderBounds | UpdateType.Children);
this.childUpdateType |= UpdateType.Global | UpdateType.Clipping;
}

@@ -979,0 +994,0 @@ get color() {

@@ -43,4 +43,5 @@ export declare const PROTOCOL_REGEX: RegExp;

export declare function boundInsideBound(bound1: Bound, bound2: Bound): boolean;
export declare function boundLargeThanBound(bound1: Bound, bound2: Bound): boolean;
export declare function isBoundPositive(bound: Bound): boolean;
export declare function isRectPositive(rect: Rect): boolean;
export declare function convertUrlToAbsolute(url: string): string;

@@ -173,2 +173,8 @@ /*

}
export function boundLargeThanBound(bound1, bound2) {
return (bound1.x1 < bound2.x1 &&
bound1.x2 > bound2.x2 &&
bound1.y1 < bound2.y1 &&
bound1.y2 > bound2.y2);
}
export function isBoundPositive(bound) {

@@ -175,0 +181,0 @@ return bound.x1 < bound.x2 && bound.y1 < bound.y2;

@@ -7,3 +7,3 @@ /**

export declare const EPSILON = 0.000001;
export declare let ARRAY_TYPE: ArrayConstructor | Float32ArrayConstructor;
export declare let ARRAY_TYPE: Float32ArrayConstructor | ArrayConstructor;
export declare const RANDOM: () => number;

@@ -10,0 +10,0 @@ export declare const ANGLE_ORDER = "zyx";

{
"name": "@lightningjs/renderer",
"version": "2.1.0",
"version": "2.1.1",
"description": "Lightning 3 Renderer",

@@ -5,0 +5,0 @@ "type": "module",

@@ -48,2 +48,3 @@ /*

boundInsideBound,
boundLargeThanBound,
} from './lib/utils.js';

@@ -702,2 +703,3 @@ import { Matrix3d } from './lib/Matrix3d.js';

public updateType = UpdateType.All;
public childUpdateType = UpdateType.None;

@@ -852,3 +854,3 @@ public globalTransform?: Matrix3d;

const parent = this.props.parent;
if (parent && !(parent.updateType & UpdateType.Children)) {
if (parent !== null && !(parent.updateType & UpdateType.Children)) {
parent.setUpdateType(UpdateType.Children);

@@ -963,3 +965,2 @@ }

const parent = this.props.parent;
let childUpdateType = UpdateType.None;

@@ -1011,3 +1012,3 @@ if (this.updateType & UpdateType.ParentRenderTexture) {

childUpdateType |= UpdateType.Global;
this.childUpdateType |= UpdateType.Global;
}

@@ -1031,3 +1032,2 @@

if (this.renderState === CoreNodeRenderState.OutOfBounds) {
this.updateType = 0;
return;

@@ -1040,4 +1040,4 @@ }

childUpdateType |= UpdateType.Clipping;
childUpdateType |= UpdateType.RenderBounds;
this.childUpdateType |= UpdateType.Clipping;
this.childUpdateType |= UpdateType.RenderBounds;
}

@@ -1056,3 +1056,3 @@

);
childUpdateType |= UpdateType.WorldAlpha;
this.childUpdateType |= UpdateType.WorldAlpha;
}

@@ -1108,11 +1108,16 @@

) {
this.children.forEach((child) => {
// Trigger the depenedent update types on the child
child.setUpdateType(childUpdateType);
// If child has no updates, skip
for (let i = 0; i < this.children.length; i++) {
const child = this.children[i];
if (child === undefined) {
continue;
}
child.setUpdateType(this.childUpdateType);
if (child.updateType === 0) {
return;
continue;
}
child.update(delta, this.clippingRect);
});
}
}

@@ -1129,2 +1134,3 @@

this.updateType = 0;
this.childUpdateType = 0;
}

@@ -1203,2 +1209,15 @@

// check if we're larger then our parent, we're definitely in the viewport
if (boundLargeThanBound(this.renderBound, this.strictBound)) {
return CoreNodeRenderState.InViewport;
}
// check if we dont have dimensions, take our parent's render state
if (
this.parent !== null &&
(this.props.width === 0 || this.props.height === 0)
) {
return this.parent.renderState;
}
return CoreNodeRenderState.OutOfBounds;

@@ -1218,2 +1237,23 @@ }

updateBoundingRect() {
const { renderCoords, globalTransform: transform } = this;
assertTruthy(transform);
assertTruthy(renderCoords);
const { tb, tc } = transform;
const { x1, y1, x3, y3 } = renderCoords;
if (tb === 0 || tc === 0) {
this.renderBound = createBound(x1, y1, x3, y3, this.renderBound);
} else {
const { x2, x4, y2, y4 } = renderCoords;
this.renderBound = createBound(
Math.min(x1, x2, x3, x4),
Math.min(y1, y2, y3, y4),
Math.max(x1, x2, x3, x4),
Math.max(y1, y2, y3, y4),
this.renderBound,
);
}
}
createRenderBounds(): void {

@@ -1345,22 +1385,2 @@ assertTruthy(this.stage);

updateBoundingRect() {
const { renderCoords, globalTransform: transform } = this;
assertTruthy(transform);
assertTruthy(renderCoords);
const { tb, tc } = transform;
const { x1, y1, x3, y3 } = renderCoords;
if (tb === 0 || tc === 0) {
this.renderBound = createBound(x1, y1, x3, y3, this.renderBound);
} else {
const { x2, x4, y2, y4 } = renderCoords;
this.renderBound = createBound(
Math.min(x1, x2, x3, x4),
Math.min(y1, y2, y3, y4),
Math.max(x1, x2, x3, x4),
Math.max(y1, y2, y3, y4),
this.renderBound,
);
}
}
/**

@@ -1723,3 +1743,8 @@ * This function calculates the clipping rectangle for a node.

this.props.alpha = value;
this.setUpdateType(UpdateType.PremultipliedColors | UpdateType.WorldAlpha);
this.setUpdateType(
UpdateType.PremultipliedColors |
UpdateType.WorldAlpha |
UpdateType.Children,
);
this.childUpdateType |= UpdateType.Global;
}

@@ -1744,2 +1769,3 @@

);
this.childUpdateType |= UpdateType.Global | UpdateType.Clipping;
}

@@ -1746,0 +1772,0 @@

@@ -247,2 +247,11 @@ /*

export function boundLargeThanBound(bound1: Bound, bound2: Bound) {
return (
bound1.x1 < bound2.x1 &&
bound1.x2 > bound2.x2 &&
bound1.y1 < bound2.y1 &&
bound1.y2 > bound2.y2
);
}
export function isBoundPositive(bound: Bound): boolean {

@@ -249,0 +258,0 @@ return bound.x1 < bound.x2 && bound.y1 < bound.y2;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc