Disable GCODE viewer if browser is unsupported
This commit is contained in:
parent
397f762182
commit
611c1ccf4a
2 changed files with 20 additions and 7 deletions
|
|
@ -104,8 +104,11 @@ GCODE.ui = (function(){
|
|||
if(!Modernizr.webworkers)fatal.push("<li>Your browser doesn't seem to support HTML5 Web Workers, this application won't work without it.</li>");
|
||||
if(!Modernizr.svg)fatal.push("<li>Your browser doesn't seem to support HTML5 SVG, this application won't work without it.</li>");
|
||||
|
||||
var errorList = document.getElementById("errorList");
|
||||
if(fatal.length>0){
|
||||
document.getElementById('errorList').innerHTML = '<ul>' + fatal.join('') + '</ul>';
|
||||
if (errorList) {
|
||||
errorList.innerHTML = '<ul>' + fatal.join('') + '</ul>';
|
||||
}
|
||||
console.log("Initialization failed: unsupported browser.")
|
||||
return false;
|
||||
}
|
||||
|
|
@ -117,8 +120,10 @@ GCODE.ui = (function(){
|
|||
if(!Modernizr.draganddrop)warnings.push("<li>Your browser doesn't seem to support HTML5 Drag'n'Drop, Drop area will not work.</li>");
|
||||
|
||||
if(warnings.length>0){
|
||||
document.getElementById('errorList').innerHTML = '<ul>' + wanings.join('') + '</ul>';
|
||||
console.log("Initialization succeeded with warnings.")
|
||||
if (errorList) {
|
||||
errorList.innerHTML = '<ul>' + warnings.join('') + '</ul>';
|
||||
}
|
||||
console.log("Initialization succeeded with warnings.", warnings);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
|
@ -138,12 +143,12 @@ GCODE.ui = (function(){
|
|||
init: function(options){
|
||||
if (options) setOptions(options);
|
||||
if (!options.container) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
var capabilitiesResult = checkCapabilities();
|
||||
if (!capabilitiesResult) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
setProgress("", 0);
|
||||
|
|
@ -159,6 +164,8 @@ GCODE.ui = (function(){
|
|||
toolOffsets: options.toolOffsets
|
||||
});
|
||||
GCODE.renderer.render(0, 0);
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
|
|
@ -196,4 +203,4 @@ GCODE.ui = (function(){
|
|||
switchCommands(layerNum, first, last);
|
||||
}
|
||||
}
|
||||
}());
|
||||
}());
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ $(function() {
|
|||
self._configureLayerCommandSlider(commandSliderElement);
|
||||
|
||||
self.settings.requestData(function() {
|
||||
GCODE.ui.init({
|
||||
var initResult = GCODE.ui.init({
|
||||
container: "#gcode_canvas",
|
||||
onProgress: self._onProgress,
|
||||
onModelLoaded: self._onModelLoaded,
|
||||
|
|
@ -244,6 +244,12 @@ $(function() {
|
|||
toolOffsets: self._retrieveToolOffsets(),
|
||||
invertAxes: self._retrieveAxesConfiguration()
|
||||
});
|
||||
|
||||
if (!initResult) {
|
||||
log.info("Could not initialize GCODE viewer component");
|
||||
return;
|
||||
}
|
||||
|
||||
self.synchronizeOptions();
|
||||
self.enabled = true;
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue