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

gl-util

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gl-util - npm Package Compare versions

Comparing version 3.0.9 to 3.1.0

23

context.js

@@ -28,7 +28,9 @@ /** @module gl-util/context */

attrs: 'attributes attrs contextAttributes',
pixelRatio: 'pixelRatio pxRatio px ratio pxratio pixelratio'
pixelRatio: 'pixelRatio pxRatio px ratio pxratio pixelratio',
width: 'w width',
height: 'h height'
}, true)
}
if (!o.pixelRatio) o.pixelRatio = window.pixelRatio || 1
if (!o.pixelRatio) o.pixelRatio = global.pixelRatio || 1

@@ -60,6 +62,11 @@ // make sure there is container and canvas

else if (!o.canvas) {
o.container = document.body || document.documentElement
o.canvas = createCanvas()
o.container.appendChild(o.canvas)
resize(o)
if (typeof document !== 'undefined') {
o.container = document.body || document.documentElement
o.canvas = createCanvas()
o.container.appendChild(o.canvas)
resize(o)
}
else {
throw Error('Not DOM environment. Use headless-gl.')
}
}

@@ -88,4 +95,4 @@

if (o.container == document.body) {
if (!document.body.style.width) o.canvas.width = o.width || (o.pixelRatio * window.innerWidth)
if (!document.body.style.height) o.canvas.height = o.height || (o.pixelRatio * window.innerHeight)
if (!document.body.style.width) o.canvas.width = o.width || (o.pixelRatio * global.innerWidth)
if (!document.body.style.height) o.canvas.height = o.height || (o.pixelRatio * global.innerHeight)
}

@@ -92,0 +99,0 @@ else {

{
"name": "gl-util",
"version": "3.0.9",
"version": "3.1.0",
"description": "Set of practical webgl utils",

@@ -34,4 +34,5 @@ "main": "index.js",

"devDependencies": {
"gl": "^4.1.1",
"tape": "^4.9.1"
}
}

@@ -5,4 +5,8 @@ 'use strict'

let context = require('../context')
let isBrowser = require('is-browser')
let createGl = require('gl')
t('context over context', t => {
if (!isBrowser) return t.end()
let gl = context()

@@ -16,2 +20,3 @@

t('context container as string', t => {
if (!isBrowser) return t.end()
let canvas = document.body.appendChild(document.createElement('canvas'))

@@ -25,1 +30,9 @@ canvas.id = 'canvas'

})
t('headless', t => {
let gl = context(createGl(10, 10))
t.equal(gl, context(gl))
t.end()
})
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