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.3 to 3.0.4

test/context.js

37

context.js

@@ -35,5 +35,7 @@ /** @module gl-util/context */

if (o.gl) {
if (!o.container) o.container = o.gl.canvas
return o.gl
}
if (o.canvas) {
o.container = o.canvas.parentNode
}
if (o.container) {

@@ -49,24 +51,16 @@ if (typeof o.container === 'string') {

}
else {
else if (!o.canvas) {
o.canvas = document.createElement('canvas')
o.container.appendChild(o.canvas)
resize(o)
}
}
else {
// blank new canvas
else if (!o.canvas) {
o.container = document.body || document.documentElement
o.canvas = document.createElement('canvas')
o.container.appendChild(o.canvas)
resize(o)
}
// resize canvas
if (o.container != document.body) {
var bounds = o.container.getBoundingClientRect()
o.canvas.width = o.width || (bounds.right - bounds.left)
o.canvas.height = o.height || (bounds.bottom - bounds.top)
}
else {
if (!document.body.style.width) o.canvas.width = o.pixelRatio * window.innerWidth
if (!document.body.style.height) o.canvas.height = o.pixelRatio * window.innerHeight
}
// make sure there is context

@@ -90,2 +84,15 @@ if (!o.gl) {

function resize (o) {
if (o.container) {
if (o.container != document.body) {
var bounds = o.container.getBoundingClientRect()
o.canvas.width = o.width || (bounds.right - bounds.left)
o.canvas.height = o.height || (bounds.bottom - bounds.top)
}
else {
if (!document.body.style.width) o.canvas.width = o.pixelRatio * window.innerWidth
if (!document.body.style.height) o.canvas.height = o.pixelRatio * window.innerHeight
}
}
}

@@ -92,0 +99,0 @@ function isCanvas (e) {

{
"name": "gl-util",
"version": "3.0.3",
"version": "3.0.4",
"description": "Set of practical webgl utils",

@@ -32,3 +32,6 @@ "main": "index.js",

"pick-by-alias": "^1.2.0"
},
"devDependencies": {
"tape": "^4.9.1"
}
}
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