update variable names

This commit is contained in:
Mario Pesch
2021-03-29 15:07:39 +02:00
parent 687ac32166
commit 255b1619b8
8 changed files with 932 additions and 688 deletions
+60 -40
View File
@@ -1,20 +1,18 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { onChangeWorkspace, clearStats } from '../../actions/workspaceActions';
import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "react-redux";
import { onChangeWorkspace, clearStats } from "../../actions/workspaceActions";
import BlocklyComponent from './BlocklyComponent';
import BlocklySvg from './BlocklySvg';
import BlocklyComponent from "./BlocklyComponent";
import BlocklySvg from "./BlocklySvg";
import * as Blockly from 'blockly/core';
import './blocks/index';
import './generator/index';
import { initialXml } from './initialXml.js';
import * as Blockly from "blockly/core";
import "./blocks/index";
import "./generator/index";
import { initialXml } from "./initialXml.js";
class BlocklyWindow extends Component {
constructor(props) {
super(props);
this.simpleWorkspace = React.createRef();
@@ -41,6 +39,7 @@ class BlocklyWindow extends Component {
Blockly.Events.disableOrphans(event);
}
});
Blockly.svgResize(workspace);
}
@@ -64,46 +63,65 @@ class BlocklyWindow extends Component {
// workspace.updateToolbox(toolbox.toolboxDef_);
}
Blockly.svgResize(workspace);
}
render() {
return (
<div>
<BlocklyComponent ref={this.simpleWorkspace}
<BlocklyComponent
ref={this.simpleWorkspace}
style={this.props.svg ? { height: 0 } : this.props.blocklyCSS}
readOnly={this.props.readOnly !== undefined ? this.props.readOnly : false}
trashcan={this.props.trashcan !== undefined ? this.props.trashcan : true}
readOnly={
this.props.readOnly !== undefined ? this.props.readOnly : false
}
trashcan={
this.props.trashcan !== undefined ? this.props.trashcan : true
}
renderer={this.props.renderer}
zoom={{ // https://developers.google.com/blockly/guides/configure/web/zoom
controls: this.props.zoomControls !== undefined ? this.props.zoomControls : true,
zoom={{
// https://developers.google.com/blockly/guides/configure/web/zoom
controls:
this.props.zoomControls !== undefined
? this.props.zoomControls
: true,
wheel: false,
startScale: 1,
maxScale: 3,
minScale: 0.3,
scaleSpeed: 1.2
scaleSpeed: 1.2,
}}
grid={this.props.grid !== undefined && !this.props.grid ? {} :
{ // https://developers.google.com/blockly/guides/configure/web/grid
spacing: 20,
length: 1,
colour: '#4EAF47', // senseBox-green
snap: false
}}
media={'/media/blockly/'}
move={this.props.move !== undefined && !this.props.move ? {} :
{ // https://developers.google.com/blockly/guides/configure/web/move
scrollbars: true,
drag: true,
wheel: false
}}
initialXml={this.props.initialXml ? this.props.initialXml : initialXml}
>
</BlocklyComponent >
{this.props.svg && this.props.initialXml ? <BlocklySvg initialXml={this.props.initialXml} /> : null}
grid={
this.props.grid !== undefined && !this.props.grid
? {}
: {
// https://developers.google.com/blockly/guides/configure/web/grid
spacing: 20,
length: 1,
colour: "#4EAF47", // senseBox-green
snap: false,
}
}
media={"/media/blockly/"}
move={
this.props.move !== undefined && !this.props.move
? {}
: {
// https://developers.google.com/blockly/guides/configure/web/move
scrollbars: true,
drag: true,
wheel: false,
}
}
initialXml={
this.props.initialXml ? this.props.initialXml : initialXml
}
></BlocklyComponent>
{this.props.svg && this.props.initialXml ? (
<BlocklySvg initialXml={this.props.initialXml} />
) : null}
</div>
);
};
}
}
BlocklyWindow.propTypes = {
@@ -114,10 +132,12 @@ BlocklyWindow.propTypes = {
workspaceXML: PropTypes.string.isRequired,
};
const mapStateToProps = state => ({
const mapStateToProps = (state) => ({
renderer: state.general.renderer,
language: state.general.language.Blockly,
workspaceXML: state.workspace.code.xml,
});
export default connect(mapStateToProps, { onChangeWorkspace, clearStats })(BlocklyWindow);
export default connect(mapStateToProps, { onChangeWorkspace, clearStats })(
BlocklyWindow
);