js2flowchart
Version:
> Why? While I've been working on [Under-the-hood-ReactJS](https://github.com/Bogdan-Lyashenko/Under-the-hood-ReactJS) I spent enormous amount of time on creating schemes. Each change in code or flowchart affects all entire scheme instantly, forcing you t
26 lines • 1.44 kB
JavaScript
import { getRoundedRectangle, getCircle } from 'shared/utils/svgPrimitives';
import { assignState } from 'shared/utils/composition';
import { setupCompleteState, setupBasicBehaviour, setupInitialSelectors, delegateInit } from './BaseShape';
var ENTITY_FIELD_NAME = 'Rectangle';
var setupRectangleBehavior = function setupRectangleBehavior(state) {
return {
print: function print() {
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var theme = state.theme,
dotTheme = theme.dot;
var _state$position = state.position,
x = _state$position.x,
y = _state$position.y,
_state$dimensions = state.dimensions,
w = _state$dimensions.w,
h = _state$dimensions.h,
node = state.node;
return "\n <g>\n ".concat(getRoundedRectangle(x, y, w, h, theme), "\n ").concat(this.printName(), "\n ").concat(node.chain ? getCircle(x + dotTheme.offset, y + h - dotTheme.offset, dotTheme.radius, dotTheme) : '', "\n ").concat(this.printDebugInfo(config), "\n </g>");
}
};
};
export var Rectangle = function Rectangle(initialState) {
var state = setupCompleteState(initialState);
return assignState(state, [setupInitialSelectors, setupBasicBehaviour, setupRectangleBehavior]);
};
export default delegateInit(Rectangle, ENTITY_FIELD_NAME);