Skip to content

Commit

Permalink
issue #887 corrrect loading behaviour, fix not supported IE functions
Browse files Browse the repository at this point in the history
  • Loading branch information
bjost2s committed Oct 15, 2020
1 parent 7e93a22 commit 1f872f2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
Expand Up @@ -33,6 +33,14 @@ define(["require", "exports", "./wires", "./const.robots", "./robotBlock", "./po
exports.CircuitVisualization = void 0;
var SEP = 2.5;
var STROKE = 1.8;
// fix for IE which does not have the remove function
if (!('remove' in Element.prototype)) {
Element.prototype.remove = function () {
if (this.parentNode) {
this.parentNode.removeChild(this);
}
};
}
var CircuitVisualization = /** @class */ (function () {
function CircuitVisualization(workspace, dom) {
var _this = this;
Expand Down
10 changes: 9 additions & 1 deletion OpenRobertaServer/staticResources/js/main.js
Expand Up @@ -116,7 +116,15 @@ require.config({
'blockly': {
exports: 'Blockly'
},

'confVisualization': {
deps: ['blockly']
},
'robotBlock': {
deps: ['blockly']
},
'port': {
deps: ['blockly']
},
'volume-meter': {
exports: "Volume",
init: function() {
Expand Down
Expand Up @@ -6,6 +6,15 @@ import { Port } from "./port";
const SEP = 2.5;
const STROKE = 1.8;

// fix for IE which does not have the remove function
if (!('remove' in Element.prototype)) {
(Element.prototype as any).remove = function() {
if (this.parentNode) {
this.parentNode.removeChild(this);
}
};
}

export class CircuitVisualization {
components: {};
connections: any;
Expand Down Expand Up @@ -91,7 +100,8 @@ export class CircuitVisualization {

injectRobotBoard(): void {
if (this.robotXml) {
(this.robotXml as any).remove();
(this.robotXml as any).remove();

}
(<any>window).Blockly.Blocks['robot'] = createRobotBlock(this.currentRobot);
const robotXml = `<instance x="250" y="250"><block type="robot" id="robot"></block></instance>`;
Expand Down

0 comments on commit 1f872f2

Please sign in to comment.