Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-annotation

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-annotation - npm Package Compare versions

Comparing version 2.2.0 to 2.2.1

27

lib/Connector/Connector.js

@@ -10,2 +10,4 @@ "use strict";

var _Handle = _interopRequireDefault(require("../Handle"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -54,2 +56,4 @@

value: function render() {
var _this = this;
var _this$props = this.props,

@@ -59,3 +63,4 @@ color = _this$props.color,

dy = _this$props.dy,
customID = _this$props.customID;
customID = _this$props.customID,
editMode = _this$props.editMode;

@@ -79,2 +84,20 @@ if (dx === 0 && dy === 0) {

var handles;
if (editMode && d.handles && d.handles.length > 0) {
handles = d.handles.map(function (h, i) {
return _react.default.createElement(_Handle.default, {
key: "connectorhandle-".concat(i),
handleStart: _this.props.dragStart,
handleStop: _this.props.dragEnd,
x: h.x,
y: h.y,
offsetParent: h.offsetParent && _this.connector,
handleDrag: function handleDrag(e, data) {
_this.props.dragConnectorSettings(e, d.handleFunction(h, data));
}
});
});
}
return _react.default.createElement("g", _extends({

@@ -99,3 +122,3 @@ className: "annotation-connector"

}, attrs), c.attrs.text);
}), childrenWithProps);
}), childrenWithProps, handles);
}

@@ -102,0 +125,0 @@ }]);

@@ -55,4 +55,5 @@ "use strict";

width = _ref.width,
height = _ref.height;
return (0, _typeCurve.default)({
height = _ref.height,
editMode = _ref.editMode;
var components = (0, _typeCurve.default)({
curve: curve,

@@ -67,4 +68,18 @@ points: points,

width: width,
height: height
height: height,
editMode: editMode
});
components.handleKeys = {
points: components.handles
};
components.handleFunction = function (h, data) {
var p = components.points.slice(0);
p[h.index] = [h.x + data.oDeltaX, h.y + data.oDeltaY];
return {
points: p
};
};
return components;
}

@@ -71,0 +86,0 @@ }]);

18

lib/EditableAnnotation.js

@@ -118,4 +118,4 @@ "use strict";

}, {
key: "dragSubjectSettings",
value: function dragSubjectSettings(event, data) {
key: "dragConnectorSettings",
value: function dragConnectorSettings(event, data) {
var _this3 = this;

@@ -128,5 +128,14 @@

}, {
key: "dragSubjectSettings",
value: function dragSubjectSettings(event, data) {
var _this4 = this;
this.setState(data, function () {
if (_this4.props.onDrag) _this4.props.onDrag(_this4.getData());
});
}
}, {
key: "dragNote",
value: function dragNote(event, data) {
var _this4 = this;
var _this5 = this;

@@ -137,3 +146,3 @@ this.setState({

}, function () {
if (_this4.props.onDrag) _this4.props.onDrag(_this4.getData());
if (_this5.props.onDrag) _this5.props.onDrag(_this5.getData());
});

@@ -148,2 +157,3 @@ }

dragSubjectSettings: this.dragSubjectSettings.bind(this),
dragConnectorSettings: this.dragConnectorSettings.bind(this),
dragEnd: this.dragEnd.bind(this),

@@ -150,0 +160,0 @@ dragStart: this.dragStart.bind(this),

@@ -34,2 +34,4 @@ "use strict";

var FILLABLE = ["SubjectCircle", "SubjectRect"];
var Subject =

@@ -56,3 +58,7 @@ /*#__PURE__*/

editMode = _this$props.editMode,
color = _this$props.color;
color = _this$props.color,
_this$props$fill = _this$props.fill,
fill = _this$props$fill === void 0 ? "none" : _this$props$fill,
_this$props$fillOpaci = _this$props.fillOpacity,
fillOpacity = _this$props$fillOpaci === void 0 ? 1 : _this$props$fillOpaci;
var d = this.getComponents(this.props) || {};

@@ -86,2 +92,3 @@ var handles;

var honorFill = FILLABLE.indexOf(this.name) !== -1;
return _react.default.createElement("g", _extends({

@@ -106,3 +113,4 @@ className: "annotation-subject"

className: c.className,
fill: "none",
fill: honorFill && fill || "none",
fillOpacity: honorFill && fillOpacity,
stroke: color

@@ -109,0 +117,0 @@ }, attrs), c.attrs.text);

@@ -20,4 +20,2 @@ "use strict";

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -31,4 +29,2 @@

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

@@ -40,2 +36,6 @@

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var SubjectBracket =

@@ -47,5 +47,17 @@ /*#__PURE__*/

function SubjectBracket() {
var _getPrototypeOf2;
var _this;
_classCallCheck(this, SubjectBracket);
return _possibleConstructorReturn(this, _getPrototypeOf(SubjectBracket).apply(this, arguments));
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SubjectBracket)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "name", "SubjectBracket");
return _this;
}

@@ -52,0 +64,0 @@

@@ -20,4 +20,2 @@ "use strict";

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -31,4 +29,2 @@

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

@@ -40,2 +36,6 @@

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var SubjectCircle =

@@ -47,5 +47,17 @@ /*#__PURE__*/

function SubjectCircle() {
var _getPrototypeOf2;
var _this;
_classCallCheck(this, SubjectCircle);
return _possibleConstructorReturn(this, _getPrototypeOf(SubjectCircle).apply(this, arguments));
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SubjectCircle)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "name", "SubjectCircle");
return _this;
}

@@ -52,0 +64,0 @@

@@ -20,4 +20,2 @@ "use strict";

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -31,4 +29,2 @@

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

@@ -40,2 +36,6 @@

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var SubjectRect =

@@ -47,5 +47,17 @@ /*#__PURE__*/

function SubjectRect() {
var _getPrototypeOf2;
var _this;
_classCallCheck(this, SubjectRect);
return _possibleConstructorReturn(this, _getPrototypeOf(SubjectRect).apply(this, arguments));
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SubjectRect)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "name", "SubjectRect");
return _this;
}

@@ -52,0 +64,0 @@

@@ -28,4 +28,2 @@ "use strict";

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

@@ -37,2 +35,6 @@

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
var SubjectThreshold =

@@ -44,5 +46,17 @@ /*#__PURE__*/

function SubjectThreshold() {
var _getPrototypeOf2;
var _this;
_classCallCheck(this, SubjectThreshold);
return _possibleConstructorReturn(this, _getPrototypeOf(SubjectThreshold).apply(this, arguments));
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SubjectThreshold)).call.apply(_getPrototypeOf2, [this].concat(args)));
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "name", "SubjectThreshold");
return _this;
}

@@ -49,0 +63,0 @@

@@ -22,7 +22,6 @@ "use strict";

var className = (0, _classnames.default)("badge", props.className);
return (0, _Type.default)(_objectSpread({
disable: ["connector", "note"]
}, props, {
return (0, _Type.default)(_objectSpread({}, props, {
disable: ["connector", "note"],
className: className
}), null, null, _SubjectBadge.default);
}

@@ -24,5 +24,4 @@ "use strict";

var className = (0, _classnames.default)("bracket", props.className);
return (0, _Type.default)(_objectSpread({
disable: ["connector"]
}, props, {
return (0, _Type.default)(_objectSpread({}, props, {
disable: ["connector"],
className: className

@@ -29,0 +28,0 @@ }), null, null, _SubjectBracket.default, {

@@ -95,6 +95,6 @@ "use strict";

events: events
}), ConnectorType && _react.default.createElement(ConnectorType, connector, ConnectorEndType && _react.default.createElement(ConnectorEndType, null)), Subject && disable.indexOf("subject") === -1 && _react.default.createElement(Subject, null), note && disable.indexOf("note") === -1 && (_react.default.isValidElement(note) || typeof note === "function") ? _react.default.createElement(_JSXNote.default, {
}), ConnectorType && _react.default.createElement(ConnectorType, connector, ConnectorEndType && _react.default.createElement(ConnectorEndType, null)), Subject && disable.indexOf("subject") === -1 && _react.default.createElement(Subject, null), note && disable.indexOf("note") === -1 && (_react.default.isValidElement(note) || typeof note === "function" ? _react.default.createElement(_JSXNote.default, {
noteDefaultProps: NoteDefaultProps,
note: note
}) : _react.default.createElement(NoteType, _extends({}, NoteDefaultProps, note)));
}) : _react.default.createElement(NoteType, _extends({}, NoteDefaultProps, note))));
}
{
"name": "react-annotation",
"description": "React components for annotating SVG elements ",
"version": "2.2.0",
"version": "2.2.1",
"homepage": ".",

@@ -6,0 +6,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc