-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(xod-client, xod-project, xod-arduino): make the new user-friendl…
…y table-log works fine, show correct labels and etc
- Loading branch information
Showing
8 changed files
with
136 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
packages/xod-client/src/project/components/nodeParts/TableLogNodeBody.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
import * as XP from 'xod-project'; | ||
|
||
import { NODE_CORNER_RADIUS } from '../../nodeLayout'; | ||
import NodeLabel from './NodeLabel'; | ||
import VariadicHandle from './VariadicHandle'; | ||
|
||
const NODE_BODY_RECT_PROPS = { | ||
rx: NODE_CORNER_RADIUS, | ||
ry: NODE_CORNER_RADIUS, | ||
// pxSize is set in root svg, let's occupy it all | ||
width: '100%', | ||
height: '100%', | ||
}; | ||
|
||
const TableLogNodeBody = props => ( | ||
<g className={classNames('watch-node', { active: props.isDebugSession })}> | ||
<rect className="body" {...NODE_BODY_RECT_PROPS} /> | ||
<NodeLabel | ||
text={props.nodeValue || props.label || XP.getBaseName(props.type)} | ||
width={props.pxSize.width} | ||
height={props.pxSize.height} | ||
/> | ||
<rect className="outline" {...NODE_BODY_RECT_PROPS} /> | ||
<VariadicHandle | ||
pxSize={props.pxSize} | ||
onMouseDown={event => { | ||
event.stopPropagation(); | ||
props.onVariadicHandleDown(event, props.id); | ||
}} | ||
/> | ||
</g> | ||
); | ||
|
||
TableLogNodeBody.propTypes = { | ||
id: PropTypes.string, | ||
type: PropTypes.string, | ||
label: PropTypes.string, | ||
pxSize: PropTypes.shape({ | ||
width: PropTypes.number, | ||
height: PropTypes.number, | ||
}), | ||
nodeValue: PropTypes.string, | ||
isDebugSession: PropTypes.bool, | ||
onVariadicHandleDown: PropTypes.func, | ||
}; | ||
|
||
export default TableLogNodeBody; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters