diff --git a/package.json b/package.json index 0069082..c4e3e1a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cobe", - "version": "0.6.1", + "version": "0.6.2", "type": "module", "main": "./dist/index.esm.js", "files": [ diff --git a/src/index.d.ts b/src/index.d.ts index 92e17ba..a4062ea 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -24,6 +24,7 @@ export interface COBEOptions { opacity?: number offset?: [number, number] scale?: number + context?: WebGLContextAttributes } export default function createGlobe( diff --git a/src/index.js b/src/index.js index 7d48ff9..3f2434c 100644 --- a/src/index.js +++ b/src/index.js @@ -70,6 +70,7 @@ export default (canvas, opts) => { antialias: true, depth: false, preserveDrawingBuffer: false, + ...opts.context, }, settings: { [OPT_DPR]: opts[OPT_DPR] || 1, @@ -158,9 +159,9 @@ export default (canvas, opts) => { ], }, onRender: ({ uniforms }) => { - const state = {} + let state = {} if (opts.onRender) { - opts.onRender(state) + state = opts.onRender(state) || state for (let k in OPT_MAPPING) { if (state[k] !== undefined) { uniforms[OPT_MAPPING[k]].value = state[k]