-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathshow_no_webgl_msg.js
47 lines (37 loc) · 1.19 KB
/
show_no_webgl_msg.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* Copyright 2012-2016, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
var Color = require('../components/color');
var noop = function() {};
/**
* Prints a no webgl error message into the scene container
* @param {scene instance} scene
*
* Expects 'scene' to have property 'container'
*
*/
module.exports = function showWebGlMsg(scene) {
for(var prop in scene) {
if(typeof scene[prop] === 'function') scene[prop] = noop;
}
scene.destroy = function() {
scene.container.parentNode.removeChild(scene.container);
};
var div = document.createElement('div');
div.textContent = 'Webgl is not supported by your browser - visit http://get.webgl.org for more info';
div.style.cursor = 'pointer';
div.style.fontSize = '24px';
div.style.color = Color.defaults[0];
scene.container.appendChild(div);
scene.container.style.background = '#FFFFFF';
scene.container.onclick = function() {
window.open('http://get.webgl.org');
};
// return before setting up camera and onrender methods
return false;
};