New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

regl-worldview

Package Overview
Dependencies
Maintainers
11
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

regl-worldview - npm Package Compare versions

Comparing version 0.7.4 to 0.8.0

src/stories/.DS_Store

2

package.json
{
"name": "regl-worldview",
"version": "0.7.4",
"version": "0.8.0",
"description": "A reusable component for rendering 2D and 3D views using regl",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

@@ -10,6 +10,15 @@ // @flow

import flatten from "lodash/flatten";
import memoize from "lodash/memoize";
import * as React from "react";
import type { Line, Vec4, Color, Pose } from "../types";
import { defaultBlend, withPose, toRGBA, shouldConvert, pointToVec3 } from "../utils/commandUtils";
import type { Line, Vec4, Color, Pose, DepthState, BlendState } from "../types";
import {
defaultBlend,
withPose,
toRGBA,
shouldConvert,
pointToVec3,
defaultReglDepth,
defaultReglBlend,
} from "../utils/commandUtils";
import { nonInstancedGetChildrenForHitmap } from "../utils/getChildrenForHitmapDefaults";

@@ -459,8 +468,20 @@ import Command, { type CommonCommandProps } from "./Command";

// Create a new render function based on rendering settings
// Memoization is required in order to prevent creating too many functions
// that use the same arguments, potentially leading to memory leaks.
const memoizedRender = memoize(
(props: { depth?: DepthState, blend?: BlendState }) => {
const { depth = defaultReglDepth, blend = defaultReglBlend } = props;
return regl({ depth, blend });
},
(...args) => JSON.stringify(args)
);
// Disable depth for debug rendering (so lines stay visible)
const render = (debug, commands) => {
const render = (props: { debug?: boolean, depth?: DepthState, blend?: BlendState }, commands: any) => {
const { debug } = props;
if (debug) {
regl({ depth: { enable: false } })(commands);
memoizedRender({ depth: { enable: false } })(commands);
} else {
commands();
memoizedRender(props)(commands);
}

@@ -471,3 +492,3 @@ };

function renderLine(props) {
const { debug, primitive = "lines", scaleInvariant = false } = props;
const { debug, primitive = "lines", scaleInvariant = false, depth, blend } = props;
const numInputPoints = props.points.length;

@@ -508,3 +529,3 @@

render(debug, () => {
render({ debug, depth, blend }, () => {
// Use Object.assign because it's actually faster than babel's object spread polyfill.

@@ -511,0 +532,0 @@ command(

@@ -56,2 +56,30 @@ // Copyright (c) 2018-present, GM Cruise LLC

);
})
.add("<Lines> with custom depth and blend values", () => {
return (
<Worldview defaultCameraState={DEFAULT_CAMERA}>
<Lines>
{[
{
primitive: "line strip",
pose: {
position: { x: 0, y: 0, z: 0 },
orientation: { x: 0, y: 0, z: 0, w: 1 },
},
scale: { x: 2, y: 0, z: 0 },
points: [[0, -4, 0], [0, 4, 0]],
color: [1, 1, 1, 1],
blend: {
enable: true,
func: {
src: "constant color",
dst: "one",
},
color: [1, 0, 0, 1],
},
},
]}
</Lines>
</Worldview>
);
});

@@ -210,2 +210,25 @@ // @flow

export type DepthState = {
enable?: boolean,
mask?: boolean,
};
export type BlendFuncValue = string | number;
export type BlendState = {
enable?: boolean,
func?:
| BlendFuncValue
| {
src?: BlendFuncValue,
dst?: BlendFuncValue,
srcAlpha?: BlendFuncValue,
srcRGB?: BlendFuncValue,
dstRGB?: BlendFuncValue,
dstAlpha?: BlendFuncValue,
},
equation?: string | { rgb: string, alpha: string },
color?: Vec4,
};
export type ObjectHitmapId = number;

@@ -212,0 +235,0 @@ /*

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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