From d7ca6996a4fc38547655b53123786285ddc50b52 Mon Sep 17 00:00:00 2001 From: Sam El-Husseini Date: Thu, 12 Mar 2020 11:45:14 -0700 Subject: [PATCH] Update rendering playground to use rendererOverrides: (#3743) --- tests/rendering/zelos/pxtblockly/zelos.html | 35 +++----------- .../rendering/zelos/scratchblocks/zelos.html | 46 ++++--------------- tests/rendering/zelos/zelos.html | 35 +++----------- 3 files changed, 20 insertions(+), 96 deletions(-) diff --git a/tests/rendering/zelos/pxtblockly/zelos.html b/tests/rendering/zelos/pxtblockly/zelos.html index 6d00f750e..4568ba25e 100644 --- a/tests/rendering/zelos/pxtblockly/zelos.html +++ b/tests/rendering/zelos/pxtblockly/zelos.html @@ -5,26 +5,6 @@ - - @@ -34,10 +14,6 @@ goog.require('Blockly.zelos.Renderer'); // Blockly.blockRendering.startDebugger(); - // This stub is a workaround in order to load pxt-blockly blocks, as they - // rely on a setOutputShape method on the block. - Blockly.BlockSvg.prototype.setOutputShape = function() { }; - var blocklyDiv = document.getElementById('blocklyDiv'); var workspace; window.addEventListener('message', function (msg) { @@ -56,6 +32,11 @@ workspace = Blockly.inject(blocklyDiv, { renderer: 'zelos', + rendererOverrides: { + 'FIELD_TEXT_FONTFAMILY': '"Helvetica Neue", "Segoe UI", Helvetica, sans-serif', + 'FIELD_TEXT_FONTWEIGHT': 'bold', + 'FIELD_TEXT_FONTSIZE': 12 + }, move: { scrollbars: true, drag: true, @@ -66,10 +47,6 @@ startScale: 2, } }); - var constants = workspace.getRenderer().getConstants(); - constants.FIELD_TEXT_FONTSIZE = 12; - constants.FIELD_TEXT_FONTWEIGHT = 'bold'; - constants.FIELD_TEXT_FONTFAMILY = 'Helvetica Neue'; Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(xml), workspace); @@ -82,7 +59,7 @@ from: 'zelos', text: datauri }, '*'); - }, document.getElementById('blocklycss').innerText); + }); } catch (err) { console.error(err); } diff --git a/tests/rendering/zelos/scratchblocks/zelos.html b/tests/rendering/zelos/scratchblocks/zelos.html index 3cc6810a9..877c4f4cb 100644 --- a/tests/rendering/zelos/scratchblocks/zelos.html +++ b/tests/rendering/zelos/scratchblocks/zelos.html @@ -7,31 +7,6 @@ - - - - - - @@ -34,10 +14,6 @@ goog.require('Blockly.zelos.Renderer'); // Blockly.blockRendering.startDebugger(); - // This stub is a workaround in order to load pxt-blockly blocks, as they - // rely on a setOutputShape method on the block. - Blockly.BlockSvg.prototype.setOutputShape = function() { }; - var blocklyDiv = document.getElementById('blocklyDiv'); var workspace; window.addEventListener('message', function (msg) { @@ -56,6 +32,11 @@ workspace = Blockly.inject(blocklyDiv, { renderer: 'zelos', + rendererOverrides: { + 'FIELD_TEXT_FONTFAMILY': '"Helvetica Neue", "Segoe UI", Helvetica, sans-serif', + 'FIELD_TEXT_FONTWEIGHT': 'bold', + 'FIELD_TEXT_FONTSIZE': 12 + }, move: { scrollbars: true, drag: true, @@ -66,10 +47,6 @@ startScale: 2, } }); - var constants = workspace.getRenderer().getConstants(); - constants.FIELD_TEXT_FONTSIZE = 12; - constants.FIELD_TEXT_FONTWEIGHT = 'bold'; - constants.FIELD_TEXT_FONTFAMILY = 'Helvetica Neue'; Blockly.Xml.domToWorkspace(Blockly.Xml.textToDom(xml), workspace); @@ -82,7 +59,7 @@ from: 'zelos', text: datauri }, '*'); - }, document.getElementById('blocklycss').innerText); + }); } catch (err) { console.error(err); }