UNPKG

@logicflow/extension

Version:
31 lines (30 loc) 1.27 kB
"use strict"; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; Object.defineProperty(exports, "__esModule", { value: true }); var jsx_runtime_1 = require("preact/jsx-runtime"); function Rect(props) { var x = props.x, y = props.y, _a = props.width, width = _a === void 0 ? 10 : _a, _b = props.height, height = _b === void 0 ? 10 : _b, radius = props.radius, className = props.className; var leftTopX = x - width / 2; var leftTopY = y - height / 2; var attrs = __assign(__assign({ // default cx: 0, cy: 0, rx: radius || 0, ry: radius || 0, fill: 'transparent', fillOpacity: 1, strokeWidth: '1px', stroke: '#000', strokeOpacity: 1, className: "lf-basic-shape ".concat(className) }, props), { x: leftTopX, y: leftTopY }); return (0, jsx_runtime_1.jsx)("rect", __assign({}, attrs)); } exports.default = Rect; Rect.defaultProps = { radius: 0, stroke: '', strokeDasharray: '', className: '', };