mirror of
https://github.com/xodio/xod.git
synced 2026-03-25 18:16:55 +01:00
style(components&containers): add empty lines between methods
This commit is contained in:
@@ -8,14 +8,17 @@ class CreateNodeWidget extends React.Component {
|
||||
this.onAddNodeClick = this.onAddNodeClick.bind(this);
|
||||
this.onNodeTypeChange = this.onNodeTypeChange.bind(this);
|
||||
}
|
||||
|
||||
onAddNodeClick(event) {
|
||||
this.props.onAddNodeClick();
|
||||
event.target.blur();
|
||||
}
|
||||
|
||||
onNodeTypeChange(event) {
|
||||
this.props.onNodeTypeChange(event.target.value);
|
||||
event.target.blur();
|
||||
}
|
||||
|
||||
render() {
|
||||
const nodeTypes = R.values(this.props.nodeTypes);
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ class Inspector extends React.Component {
|
||||
|
||||
this.createWidgets(props);
|
||||
}
|
||||
|
||||
componentWillUpdate(nextProps) {
|
||||
this.createWidgets(nextProps);
|
||||
}
|
||||
@@ -66,6 +67,7 @@ class Inspector extends React.Component {
|
||||
this.createMultipleSelectionWidgets(selection);
|
||||
}
|
||||
}
|
||||
|
||||
createEmptySelectionWidgets() {
|
||||
this.widgets = [
|
||||
new Widgets.HintWidget({
|
||||
@@ -73,6 +75,7 @@ class Inspector extends React.Component {
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
createNodeWidgets(props, selection) {
|
||||
const node = props.nodes[selection.id];
|
||||
const nodeType = props.nodeTypes[node.typeId];
|
||||
@@ -105,6 +108,7 @@ class Inspector extends React.Component {
|
||||
this.widgets = widgets;
|
||||
}
|
||||
}
|
||||
|
||||
createLinkWidgets() {
|
||||
this.widgets = [
|
||||
new Widgets.HintWidget({
|
||||
@@ -112,6 +116,7 @@ class Inspector extends React.Component {
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
createMultipleSelectionWidgets(selection) {
|
||||
this.widgets = [
|
||||
new Widgets.HintWidget({
|
||||
|
||||
@@ -22,9 +22,11 @@ class NumberWidget extends React.Component {
|
||||
R.assoc('value', newValue, this.state)
|
||||
);
|
||||
}
|
||||
|
||||
onBlur() {
|
||||
this.props.onPropUpdate(this.state.value);
|
||||
}
|
||||
|
||||
onKeyDown(event) {
|
||||
const keycode = event.keycode || event.which;
|
||||
if (keycode === ENTER) {
|
||||
|
||||
@@ -22,9 +22,11 @@ class StringWidget extends React.Component {
|
||||
R.assoc('value', newValue, this.state)
|
||||
);
|
||||
}
|
||||
|
||||
onBlur() {
|
||||
this.props.onPropUpdate(this.state.value);
|
||||
}
|
||||
|
||||
onKeyDown(event) {
|
||||
const keycode = event.keycode || event.which;
|
||||
if (keycode === ENTER) {
|
||||
|
||||
@@ -25,6 +25,7 @@ class Node extends React.Component {
|
||||
componentDidMount() {
|
||||
this.updatePatchViewstate();
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
this.updatePatchViewstate();
|
||||
}
|
||||
@@ -34,11 +35,13 @@ class Node extends React.Component {
|
||||
this.props.onMouseUp(this.id);
|
||||
}
|
||||
}
|
||||
|
||||
onMouseDown(event) {
|
||||
if (this.props.draggable && this.props.onMouseDown) {
|
||||
this.props.onMouseDown(event, this.id);
|
||||
}
|
||||
}
|
||||
|
||||
onPinMouseUp(pinId) {
|
||||
if (this.props.isClicked && this.props.onPinMouseUp) {
|
||||
this.props.onPinMouseUp(pinId);
|
||||
@@ -53,6 +56,7 @@ class Node extends React.Component {
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
getRectProps() {
|
||||
return {
|
||||
width: this.width,
|
||||
@@ -61,6 +65,7 @@ class Node extends React.Component {
|
||||
y: SIZES.NODE.padding.y,
|
||||
};
|
||||
}
|
||||
|
||||
getBlockProps() {
|
||||
return {
|
||||
x: 0,
|
||||
@@ -69,6 +74,7 @@ class Node extends React.Component {
|
||||
height: this.getRectProps().height + (SIZES.NODE.padding.y * 2),
|
||||
};
|
||||
}
|
||||
|
||||
getTextProps() {
|
||||
const rectSize = this.getRectProps();
|
||||
return {
|
||||
|
||||
@@ -5,18 +5,23 @@ class NodeText extends React.Component {
|
||||
this.labelBbox = this.getBbox();
|
||||
this.forceUpdate();
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
this.labelBbox = this.getBbox();
|
||||
}
|
||||
|
||||
getBbox() {
|
||||
return this.refs.label.getBBox();
|
||||
}
|
||||
|
||||
getWidth() {
|
||||
return this.labelBbox.width;
|
||||
}
|
||||
|
||||
getHeight() {
|
||||
return this.labelBbox.height;
|
||||
}
|
||||
|
||||
getPosition() {
|
||||
const position = {
|
||||
x: this.props.position.x,
|
||||
@@ -31,6 +36,7 @@ class NodeText extends React.Component {
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<text
|
||||
|
||||
@@ -57,9 +57,11 @@ export default class Pin extends React.Component {
|
||||
getDirection() {
|
||||
return this.props.direction;
|
||||
}
|
||||
|
||||
isInput() {
|
||||
return (this.getDirection() === PIN_DIRECTION.INPUT);
|
||||
}
|
||||
|
||||
isOutput() {
|
||||
return (this.getDirection() === PIN_DIRECTION.OUTPUT);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ export default class App extends React.Component {
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
onUpload() {
|
||||
const isChromeApplication = window.chrome && chrome.app && chrome.app.runtime;
|
||||
if (isChromeApplication) {
|
||||
|
||||
@@ -74,6 +74,7 @@ class Editor extends React.Component {
|
||||
setModeCreating() {
|
||||
this.setEditorMode(EDITOR_MODE.CREATING_NODE);
|
||||
}
|
||||
|
||||
setModeDefault() {
|
||||
this.setEditorMode(EDITOR_MODE.DEFAULT);
|
||||
}
|
||||
|
||||
@@ -103,6 +103,7 @@ class Patch extends React.Component {
|
||||
onNodeMouseUp(id) {
|
||||
this.props.dispatch(Actions.selectNode(id));
|
||||
}
|
||||
|
||||
onNodeMouseDown(event, id) {
|
||||
const node = this.props.nodes[id].position;
|
||||
this.dragging = {
|
||||
@@ -115,9 +116,11 @@ class Patch extends React.Component {
|
||||
|
||||
this.setClickNodeId(id);
|
||||
}
|
||||
|
||||
onPinMouseUp(id) {
|
||||
this.props.dispatch(Actions.linkPin(id));
|
||||
}
|
||||
|
||||
onLinkClick(id) {
|
||||
this.props.dispatch(Actions.selectLink(id));
|
||||
}
|
||||
@@ -141,6 +144,7 @@ class Patch extends React.Component {
|
||||
this.dragGhostNode();
|
||||
this.dragGhostLink();
|
||||
}
|
||||
|
||||
onMouseUp(event) {
|
||||
if (this.state.dragNodeId) {
|
||||
const dragId = this.state.dragNodeId;
|
||||
@@ -204,6 +208,7 @@ class Patch extends React.Component {
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
setClickNodeId(id) {
|
||||
const st = R.set(
|
||||
R.lensProp('clickNodeId'),
|
||||
@@ -249,6 +254,7 @@ class Patch extends React.Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
dragGhostNode() {
|
||||
if (this.props.mode.isCreatingNode && this.state.ghostNode) {
|
||||
this.setState(
|
||||
@@ -260,6 +266,7 @@ class Patch extends React.Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
dragGhostLink() {
|
||||
if (this.props.linkingPin && this.state.ghostLink) {
|
||||
this.setState(
|
||||
@@ -288,6 +295,7 @@ class Patch extends React.Component {
|
||||
),
|
||||
}];
|
||||
}
|
||||
|
||||
createPinsState(nodeId, nodeWidth) {
|
||||
let nodePins = R.pipe(
|
||||
R.values,
|
||||
@@ -312,6 +320,7 @@ class Patch extends React.Component {
|
||||
|
||||
return PatchUtils.getPinPosition(nodePins, nodeWidth);
|
||||
}
|
||||
|
||||
createNodeState(node, customProps) {
|
||||
const props = (typeof customProps === 'object') ? customProps : {};
|
||||
|
||||
@@ -354,6 +363,7 @@ class Patch extends React.Component {
|
||||
|
||||
return R.merge(viewstate, props);
|
||||
}
|
||||
|
||||
createNodeStates(nodes) {
|
||||
let comparator = R.comparator();
|
||||
|
||||
@@ -379,10 +389,12 @@ class Patch extends React.Component {
|
||||
}, {})
|
||||
)(nodes);
|
||||
}
|
||||
|
||||
createNode(nodeState) {
|
||||
const nodeFactory = React.createFactory(Node);
|
||||
return nodeFactory(nodeState);
|
||||
}
|
||||
|
||||
createNodes(nodes) {
|
||||
const viewstate = this.createNodeStates(nodes);
|
||||
|
||||
@@ -420,6 +432,7 @@ class Patch extends React.Component {
|
||||
const linkFactory = React.createFactory(Link);
|
||||
return linkFactory(link);
|
||||
}
|
||||
|
||||
createLinkState(link, customProps) {
|
||||
const props = (typeof customProps === 'object') ? customProps : {};
|
||||
const positions = [
|
||||
@@ -448,6 +461,7 @@ class Patch extends React.Component {
|
||||
props
|
||||
);
|
||||
}
|
||||
|
||||
createLinks(links) {
|
||||
return R.pipe(
|
||||
R.values,
|
||||
|
||||
@@ -31,6 +31,7 @@ class SnackBar extends React.Component {
|
||||
this.timers = {};
|
||||
this.onClick = (timestamp) => this.hideError.bind(this, timestamp);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
nextProps.errors.forEach((error) => {
|
||||
if (!this.timers.hasOwnProperty(error.timestamp)) {
|
||||
@@ -40,12 +41,14 @@ class SnackBar extends React.Component {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
hideError(timestamp) {
|
||||
if (this.timers.hasOwnProperty(timestamp)) {
|
||||
clearTimeout(this.timer[timestamp]);
|
||||
}
|
||||
this.props.hideError(timestamp);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
|
||||
@@ -12,11 +12,13 @@ class Toolbar extends React.Component {
|
||||
this.onSave = this.onSave.bind(this);
|
||||
this.onLoad = this.onLoad.bind(this);
|
||||
}
|
||||
|
||||
onProjectNameClick() {
|
||||
return this.props.actions.updateMeta({
|
||||
name: 'Mega project',
|
||||
});
|
||||
}
|
||||
|
||||
onLoad(event) {
|
||||
const input = event.target;
|
||||
const files = input.files;
|
||||
@@ -38,11 +40,13 @@ class Toolbar extends React.Component {
|
||||
|
||||
input.value = '';
|
||||
}
|
||||
|
||||
onSave() {
|
||||
const url = `data:text/json;charset=utf8,${encodeURIComponent(this.props.projectJSON)}`;
|
||||
window.open(url, '_blank');
|
||||
window.focus();
|
||||
}
|
||||
|
||||
render() {
|
||||
const meta = this.props.meta;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user