orcasvn-react-diagrams 0.1.49 → 0.1.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -714,7 +714,9 @@ var Port$1 = /** @class */ (function () {
714
714
  }
715
715
  else if (shapeRenderer && shapeRenderer.customShapeWithJSX) {
716
716
  this.renderShape = React.forwardRef(function (props, ref) {
717
- return (React.createElement(CustomShape, { ref: ref, x: props.x, y: props.y, width: props.width, height: props.height, rotation: props.rotation, positioningAnchor: shapeRenderer.positioningAnchor, onClick: function (e) { var _a; return (_a = props.onSelected) === null || _a === void 0 ? void 0 : _a.call(props, _this.id, e); }, onMouseDown: function (e) { var _a; return (_a = props.onMouseDown) === null || _a === void 0 ? void 0 : _a.call(props, _this.id, e); }, onMouseUp: function (e) { var _a; return (_a = props.onMouseUp) === null || _a === void 0 ? void 0 : _a.call(props, _this.id, e); } }, shapeRenderer.customShapeWithJSX));
717
+ return (React.createElement(CustomShape, { ref: ref, x: props.x, y: props.y, width: props.width, height: props.height, rotation: props.rotation, positioningAnchor: shapeRenderer.positioningAnchor, onClick: function (e) { var _a; return (_a = props.onSelected) === null || _a === void 0 ? void 0 : _a.call(props, _this.id, e); }, onMouseDown: function (e) { var _a; return (_a = props.onMouseDown) === null || _a === void 0 ? void 0 : _a.call(props, _this.id, e); }, onMouseUp: function (e) { var _a; return (_a = props.onMouseUp) === null || _a === void 0 ? void 0 : _a.call(props, _this.id, e); } },
718
+ shapeRenderer.customShapeWithJSX,
719
+ props.children));
718
720
  });
719
721
  }
720
722
  }
@@ -1092,17 +1094,15 @@ var Crescent = React.forwardRef(function (props, ref) {
1092
1094
  var Rectangle = React.forwardRef(function (props, ref) {
1093
1095
  var scaledWidth = props.width;
1094
1096
  var scaledHeight = props.height;
1095
- if (props.width > 100 || props.height > 100) {
1096
- var widthRatio = props.width / 100;
1097
- var heightRatio = props.height / 100;
1098
- if (widthRatio > heightRatio) {
1099
- scaledWidth = 100;
1100
- scaledHeight = scaledHeight / widthRatio;
1101
- }
1102
- else {
1103
- scaledHeight = 100;
1104
- scaledWidth = scaledWidth / heightRatio;
1105
- }
1097
+ var widthRatio = props.width / 100;
1098
+ var heightRatio = props.height / 100;
1099
+ if (widthRatio > heightRatio) {
1100
+ scaledWidth = 100;
1101
+ scaledHeight = scaledHeight / widthRatio;
1102
+ }
1103
+ else {
1104
+ scaledHeight = 100;
1105
+ scaledWidth = scaledWidth / heightRatio;
1106
1106
  }
1107
1107
  var sw = props.stroke ? (props.strokeWidth || 1) : 0;
1108
1108
  return (React.createElement(ShapeWrapper, __assign({}, props, { ref: ref, height: props.height, width: props.width }),
@@ -1113,17 +1113,15 @@ var Rectangle = React.forwardRef(function (props, ref) {
1113
1113
  var RectangularFrame = React.forwardRef(function (props, ref) {
1114
1114
  var scaledWidth = props.width;
1115
1115
  var scaledHeight = props.height;
1116
- if (props.width > 100 || props.height > 100) {
1117
- var widthRatio = props.width / 100;
1118
- var heightRatio = props.height / 100;
1119
- if (widthRatio > heightRatio) {
1120
- scaledWidth = 100;
1121
- scaledHeight = scaledHeight / widthRatio;
1122
- }
1123
- else {
1124
- scaledHeight = 100;
1125
- scaledWidth = scaledWidth / heightRatio;
1126
- }
1116
+ var widthRatio = props.width / 100;
1117
+ var heightRatio = props.height / 100;
1118
+ if (widthRatio > heightRatio) {
1119
+ scaledWidth = 100;
1120
+ scaledHeight = scaledHeight / widthRatio;
1121
+ }
1122
+ else {
1123
+ scaledHeight = 100;
1124
+ scaledWidth = scaledWidth / heightRatio;
1127
1125
  }
1128
1126
  var vbX = 0; //(100 - scaledWidth) / 2;
1129
1127
  var vbY = 0; //(100 - scaledHeight) / 2;
@@ -8577,6 +8575,7 @@ var Element = React.forwardRef(function (props, forwardedRef) {
8577
8575
  }, []);
8578
8576
  var handleSelectedPort = React.useCallback(function (portId, e) {
8579
8577
  e.stopPropagation();
8578
+ logger.debug('Port selected', portId, e);
8580
8579
  var port = portsRef.current.find(function (p) { return p.id === portId; });
8581
8580
  if (!port)
8582
8581
  return;
@@ -8625,6 +8624,8 @@ var Element = React.forwardRef(function (props, forwardedRef) {
8625
8624
  //Handle when mouse down on port
8626
8625
  var handlePortMouseDown = React.useCallback(function (portId, e) {
8627
8626
  e.stopPropagation();
8627
+ //log debugger
8628
+ logger.debug('Port mouse down', portId, e);
8628
8629
  var port = portsRef.current.find(function (p) { return p.id === portId; });
8629
8630
  if (!port)
8630
8631
  return;
@@ -0,0 +1,5 @@
1
+ import IText from "../models/IText";
2
+ import { Port } from '../models';
3
+ export declare class CustomPort2 extends Port {
4
+ constructor(x: number, y: number, label?: IText, width?: number, height?: number);
5
+ }
package/dist/esm/index.js CHANGED
@@ -710,7 +710,9 @@ var Port$1 = /** @class */ (function () {
710
710
  }
711
711
  else if (shapeRenderer && shapeRenderer.customShapeWithJSX) {
712
712
  this.renderShape = forwardRef(function (props, ref) {
713
- return (React.createElement(CustomShape, { ref: ref, x: props.x, y: props.y, width: props.width, height: props.height, rotation: props.rotation, positioningAnchor: shapeRenderer.positioningAnchor, onClick: function (e) { var _a; return (_a = props.onSelected) === null || _a === void 0 ? void 0 : _a.call(props, _this.id, e); }, onMouseDown: function (e) { var _a; return (_a = props.onMouseDown) === null || _a === void 0 ? void 0 : _a.call(props, _this.id, e); }, onMouseUp: function (e) { var _a; return (_a = props.onMouseUp) === null || _a === void 0 ? void 0 : _a.call(props, _this.id, e); } }, shapeRenderer.customShapeWithJSX));
713
+ return (React.createElement(CustomShape, { ref: ref, x: props.x, y: props.y, width: props.width, height: props.height, rotation: props.rotation, positioningAnchor: shapeRenderer.positioningAnchor, onClick: function (e) { var _a; return (_a = props.onSelected) === null || _a === void 0 ? void 0 : _a.call(props, _this.id, e); }, onMouseDown: function (e) { var _a; return (_a = props.onMouseDown) === null || _a === void 0 ? void 0 : _a.call(props, _this.id, e); }, onMouseUp: function (e) { var _a; return (_a = props.onMouseUp) === null || _a === void 0 ? void 0 : _a.call(props, _this.id, e); } },
714
+ shapeRenderer.customShapeWithJSX,
715
+ props.children));
714
716
  });
715
717
  }
716
718
  }
@@ -1088,17 +1090,15 @@ var Crescent = forwardRef(function (props, ref) {
1088
1090
  var Rectangle = forwardRef(function (props, ref) {
1089
1091
  var scaledWidth = props.width;
1090
1092
  var scaledHeight = props.height;
1091
- if (props.width > 100 || props.height > 100) {
1092
- var widthRatio = props.width / 100;
1093
- var heightRatio = props.height / 100;
1094
- if (widthRatio > heightRatio) {
1095
- scaledWidth = 100;
1096
- scaledHeight = scaledHeight / widthRatio;
1097
- }
1098
- else {
1099
- scaledHeight = 100;
1100
- scaledWidth = scaledWidth / heightRatio;
1101
- }
1093
+ var widthRatio = props.width / 100;
1094
+ var heightRatio = props.height / 100;
1095
+ if (widthRatio > heightRatio) {
1096
+ scaledWidth = 100;
1097
+ scaledHeight = scaledHeight / widthRatio;
1098
+ }
1099
+ else {
1100
+ scaledHeight = 100;
1101
+ scaledWidth = scaledWidth / heightRatio;
1102
1102
  }
1103
1103
  var sw = props.stroke ? (props.strokeWidth || 1) : 0;
1104
1104
  return (React.createElement(ShapeWrapper, __assign({}, props, { ref: ref, height: props.height, width: props.width }),
@@ -1109,17 +1109,15 @@ var Rectangle = forwardRef(function (props, ref) {
1109
1109
  var RectangularFrame = forwardRef(function (props, ref) {
1110
1110
  var scaledWidth = props.width;
1111
1111
  var scaledHeight = props.height;
1112
- if (props.width > 100 || props.height > 100) {
1113
- var widthRatio = props.width / 100;
1114
- var heightRatio = props.height / 100;
1115
- if (widthRatio > heightRatio) {
1116
- scaledWidth = 100;
1117
- scaledHeight = scaledHeight / widthRatio;
1118
- }
1119
- else {
1120
- scaledHeight = 100;
1121
- scaledWidth = scaledWidth / heightRatio;
1122
- }
1112
+ var widthRatio = props.width / 100;
1113
+ var heightRatio = props.height / 100;
1114
+ if (widthRatio > heightRatio) {
1115
+ scaledWidth = 100;
1116
+ scaledHeight = scaledHeight / widthRatio;
1117
+ }
1118
+ else {
1119
+ scaledHeight = 100;
1120
+ scaledWidth = scaledWidth / heightRatio;
1123
1121
  }
1124
1122
  var vbX = 0; //(100 - scaledWidth) / 2;
1125
1123
  var vbY = 0; //(100 - scaledHeight) / 2;
@@ -8573,6 +8571,7 @@ var Element = forwardRef(function (props, forwardedRef) {
8573
8571
  }, []);
8574
8572
  var handleSelectedPort = useCallback(function (portId, e) {
8575
8573
  e.stopPropagation();
8574
+ logger.debug('Port selected', portId, e);
8576
8575
  var port = portsRef.current.find(function (p) { return p.id === portId; });
8577
8576
  if (!port)
8578
8577
  return;
@@ -8621,6 +8620,8 @@ var Element = forwardRef(function (props, forwardedRef) {
8621
8620
  //Handle when mouse down on port
8622
8621
  var handlePortMouseDown = useCallback(function (portId, e) {
8623
8622
  e.stopPropagation();
8623
+ //log debugger
8624
+ logger.debug('Port mouse down', portId, e);
8624
8625
  var port = portsRef.current.find(function (p) { return p.id === portId; });
8625
8626
  if (!port)
8626
8627
  return;