@pie-lib/graphing 2.17.0 → 2.18.0
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/CHANGELOG.md +13 -65
- package/package.json +9 -8
- package/src/axis/axes.jsx +1 -1
- package/src/coordinates-label.jsx +1 -1
- package/src/graph-with-controls.jsx +1 -1
- package/src/grid-setup.jsx +1 -1
- package/src/key-legend.jsx +1 -1
- package/src/labels.jsx +1 -1
- package/src/mark-label.jsx +1 -1
- package/src/toggle-bar.jsx +1 -1
- package/src/tools/circle/bg-circle.jsx +1 -1
- package/src/tools/circle/component.jsx +1 -1
- package/src/tools/polygon/line.jsx +1 -1
- package/src/tools/polygon/polygon.jsx +1 -1
- package/src/tools/shared/line/index.jsx +1 -1
- package/src/tools/shared/line/line-path.jsx +1 -1
- package/src/tools/shared/point/index.jsx +1 -1
- package/src/tools/shared/styles.js +1 -1
- package/src/tools/sine/__tests__/component.test.jsx +1 -1
- package/src/undo-redo.jsx +1 -1
- package/lib/axis/arrow.js +0 -115
- package/lib/axis/arrow.js.map +0 -1
- package/lib/axis/axes.js +0 -415
- package/lib/axis/axes.js.map +0 -1
- package/lib/axis/index.js +0 -26
- package/lib/axis/index.js.map +0 -1
- package/lib/bg.js +0 -139
- package/lib/bg.js.map +0 -1
- package/lib/container/actions.js +0 -24
- package/lib/container/actions.js.map +0 -1
- package/lib/container/index.js +0 -163
- package/lib/container/index.js.map +0 -1
- package/lib/container/marks.js +0 -27
- package/lib/container/marks.js.map +0 -1
- package/lib/container/middleware.js +0 -25
- package/lib/container/middleware.js.map +0 -1
- package/lib/container/reducer.js +0 -25
- package/lib/container/reducer.js.map +0 -1
- package/lib/coordinates-label.js +0 -109
- package/lib/coordinates-label.js.map +0 -1
- package/lib/graph-with-controls.js +0 -359
- package/lib/graph-with-controls.js.map +0 -1
- package/lib/graph.js +0 -371
- package/lib/graph.js.map +0 -1
- package/lib/grid-setup.js +0 -462
- package/lib/grid-setup.js.map +0 -1
- package/lib/grid.js +0 -176
- package/lib/grid.js.map +0 -1
- package/lib/index.js +0 -59
- package/lib/index.js.map +0 -1
- package/lib/key-legend.js +0 -246
- package/lib/key-legend.js.map +0 -1
- package/lib/label-svg-icon.js +0 -56
- package/lib/label-svg-icon.js.map +0 -1
- package/lib/labels.js +0 -299
- package/lib/labels.js.map +0 -1
- package/lib/mark-label.js +0 -321
- package/lib/mark-label.js.map +0 -1
- package/lib/shared/index.js +0 -136
- package/lib/toggle-bar.js +0 -336
- package/lib/toggle-bar.js.map +0 -1
- package/lib/tool-menu.js +0 -112
- package/lib/tool-menu.js.map +0 -1
- package/lib/tools/absolute/component.js +0 -35
- package/lib/tools/absolute/component.js.map +0 -1
- package/lib/tools/absolute/index.js +0 -63
- package/lib/tools/absolute/index.js.map +0 -1
- package/lib/tools/circle/bg-circle.js +0 -173
- package/lib/tools/circle/bg-circle.js.map +0 -1
- package/lib/tools/circle/component.js +0 -406
- package/lib/tools/circle/component.js.map +0 -1
- package/lib/tools/circle/index.js +0 -51
- package/lib/tools/circle/index.js.map +0 -1
- package/lib/tools/exponential/component.js +0 -34
- package/lib/tools/exponential/component.js.map +0 -1
- package/lib/tools/exponential/index.js +0 -71
- package/lib/tools/exponential/index.js.map +0 -1
- package/lib/tools/index.js +0 -99
- package/lib/tools/index.js.map +0 -1
- package/lib/tools/line/component.js +0 -103
- package/lib/tools/line/component.js.map +0 -1
- package/lib/tools/line/index.js +0 -16
- package/lib/tools/line/index.js.map +0 -1
- package/lib/tools/parabola/component.js +0 -34
- package/lib/tools/parabola/component.js.map +0 -1
- package/lib/tools/parabola/index.js +0 -63
- package/lib/tools/parabola/index.js.map +0 -1
- package/lib/tools/point/component.js +0 -186
- package/lib/tools/point/component.js.map +0 -1
- package/lib/tools/point/index.js +0 -32
- package/lib/tools/point/index.js.map +0 -1
- package/lib/tools/polygon/component.js +0 -518
- package/lib/tools/polygon/component.js.map +0 -1
- package/lib/tools/polygon/index.js +0 -106
- package/lib/tools/polygon/index.js.map +0 -1
- package/lib/tools/polygon/line.js +0 -157
- package/lib/tools/polygon/line.js.map +0 -1
- package/lib/tools/polygon/polygon.js +0 -165
- package/lib/tools/polygon/polygon.js.map +0 -1
- package/lib/tools/ray/component.js +0 -102
- package/lib/tools/ray/component.js.map +0 -1
- package/lib/tools/ray/index.js +0 -16
- package/lib/tools/ray/index.js.map +0 -1
- package/lib/tools/segment/component.js +0 -75
- package/lib/tools/segment/component.js.map +0 -1
- package/lib/tools/segment/index.js +0 -16
- package/lib/tools/segment/index.js.map +0 -1
- package/lib/tools/shared/arrow-head.js +0 -70
- package/lib/tools/shared/arrow-head.js.map +0 -1
- package/lib/tools/shared/icons/CorrectSVG.js +0 -36
- package/lib/tools/shared/icons/CorrectSVG.js.map +0 -1
- package/lib/tools/shared/icons/IncorrectSVG.js +0 -36
- package/lib/tools/shared/icons/IncorrectSVG.js.map +0 -1
- package/lib/tools/shared/icons/MissingSVG.js +0 -35
- package/lib/tools/shared/icons/MissingSVG.js.map +0 -1
- package/lib/tools/shared/line/index.js +0 -599
- package/lib/tools/shared/line/index.js.map +0 -1
- package/lib/tools/shared/line/line-path.js +0 -151
- package/lib/tools/shared/line/line-path.js.map +0 -1
- package/lib/tools/shared/line/with-root-edge.js +0 -155
- package/lib/tools/shared/line/with-root-edge.js.map +0 -1
- package/lib/tools/shared/point/arrow-point.js +0 -113
- package/lib/tools/shared/point/arrow-point.js.map +0 -1
- package/lib/tools/shared/point/arrow.js +0 -96
- package/lib/tools/shared/point/arrow.js.map +0 -1
- package/lib/tools/shared/point/base-point.js +0 -175
- package/lib/tools/shared/point/base-point.js.map +0 -1
- package/lib/tools/shared/point/index.js +0 -97
- package/lib/tools/shared/point/index.js.map +0 -1
- package/lib/tools/shared/styles.js +0 -58
- package/lib/tools/shared/styles.js.map +0 -1
- package/lib/tools/shared/types.js +0 -23
- package/lib/tools/shared/types.js.map +0 -1
- package/lib/tools/sine/component.js +0 -51
- package/lib/tools/sine/component.js.map +0 -1
- package/lib/tools/sine/index.js +0 -63
- package/lib/tools/sine/index.js.map +0 -1
- package/lib/tools/vector/component.js +0 -88
- package/lib/tools/vector/component.js.map +0 -1
- package/lib/tools/vector/index.js +0 -16
- package/lib/tools/vector/index.js.map +0 -1
- package/lib/undo-redo.js +0 -123
- package/lib/undo-redo.js.map +0 -1
- package/lib/use-debounce.js +0 -32
- package/lib/use-debounce.js.map +0 -1
- package/lib/utils.js +0 -307
- package/lib/utils.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/tools/polygon/index.js"],"names":["addPointToArray","point","arr","length","points","closed","hasPoint","find","p","tool","type","Component","Polygon","complete","data","mark","building","addPoint"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;;;;;AAEO,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD,EAAQC,GAAR,EAAgB;AAC7CA,EAAAA,GAAG,GAAGA,GAAG,IAAI,EAAb;;AAEA,MAAIA,GAAG,CAACC,MAAJ,KAAe,CAAnB,EAAsB;AACpB,WAAO;AAAEC,MAAAA,MAAM,EAAE,CAACH,KAAD,CAAV;AAAmBI,MAAAA,MAAM,EAAE;AAA3B,KAAP;AACD,GAFD,MAEO,IAAIH,GAAG,CAACC,MAAJ,KAAe,CAAnB,EAAsB;AAC3B,QAAI,wBAAYF,KAAZ,EAAmBC,GAAG,CAAC,CAAD,CAAtB,CAAJ,EAAgC;AAC9B,aAAO;AAAEE,QAAAA,MAAM,EAAEF,GAAV;AAAeG,QAAAA,MAAM,EAAE;AAAvB,OAAP;AACD,KAFD,MAEO;AACL,aAAO;AAAED,QAAAA,MAAM,gDAAMF,GAAN,IAAWD,KAAX,EAAR;AAA2BI,QAAAA,MAAM,EAAE;AAAnC,OAAP;AACD;AACF,GANM,MAMA,IAAIH,GAAG,CAACC,MAAJ,IAAc,CAAlB,EAAqB;AAC1B,QAAME,MAAM,GAAG,wBAAYJ,KAAZ,EAAmBC,GAAG,CAAC,CA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A,MAAhB;;AAEA,+CAAYW,IAAZ;AAAkBV,UAAAA,MAAM,EAANA,MAAlB;AAA0BD,UAAAA,MAAM,EAANA,MAA1B;AAAkCY,UAAAA,QAAQ,EAAE,CAACX;AAA7C;AACD;AACF;AAnBwB,GAAP;AAAA,CAAb","sourcesContent":["import Polygon from './component';\nimport { equalPoints } from '../../utils';\n\nexport const addPointToArray = (point, arr) => {\n arr = arr || [];\n\n if (arr.length === 0) {\n return { points: [point], closed: false };\n } else if (arr.length === 1) {\n if (equalPoints(point, arr[0])) {\n return { points: arr, closed: false };\n } else {\n return { points: [...arr, point], closed: false };\n }\n } else if (arr.length >= 2) {\n const closed = equalPoints(point, arr[0]);\n\n if (closed) {\n return { points: arr, closed };\n } else {\n const hasPoint = !!arr.find((p) => equalPoints(p, point));\n\n if (hasPoint) {\n return { points: arr, closed: false };\n } else {\n return { points: [...arr, point], closed: false };\n }\n }\n }\n};\n\nexport const tool = () => ({\n type: 'polygon',\n Component: Polygon,\n complete: (data, mark) => {\n return { ...mark, building: false, closed: true };\n },\n addPoint: (point, mark) => {\n if (!mark) {\n return {\n type: 'polygon',\n points: [point],\n closed: false,\n building: true,\n };\n } else {\n const { closed, points } = addPointToArray(point, mark.points);\n\n return { ...mark, closed, points, building: !closed };\n }\n },\n});\n"],"file":"index.js"}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports["default"] = exports.Line = void 0;
|
|
11
|
-
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
-
|
|
16
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
-
|
|
18
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
-
|
|
20
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
-
|
|
26
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
-
|
|
28
|
-
var _react = _interopRequireDefault(require("react"));
|
|
29
|
-
|
|
30
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
-
|
|
32
|
-
var _styles = require("@material-ui/core/styles");
|
|
33
|
-
|
|
34
|
-
var _plot = require("@pie-lib/plot");
|
|
35
|
-
|
|
36
|
-
var _index = require("./../../shared/index");
|
|
37
|
-
|
|
38
|
-
var utils = _interopRequireWildcard(require("../../utils"));
|
|
39
|
-
|
|
40
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
41
|
-
|
|
42
|
-
var _styles2 = require("../shared/styles");
|
|
43
|
-
|
|
44
|
-
var _excluded = ["graphProps", "classes", "from", "to", "className", "disabled", "correctness"];
|
|
45
|
-
|
|
46
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
47
|
-
|
|
48
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
49
|
-
|
|
50
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
51
|
-
|
|
52
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
53
|
-
|
|
54
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
55
|
-
|
|
56
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
57
|
-
|
|
58
|
-
var RawLine = /*#__PURE__*/function (_React$Component) {
|
|
59
|
-
(0, _inherits2["default"])(RawLine, _React$Component);
|
|
60
|
-
|
|
61
|
-
var _super = _createSuper(RawLine);
|
|
62
|
-
|
|
63
|
-
function RawLine() {
|
|
64
|
-
(0, _classCallCheck2["default"])(this, RawLine);
|
|
65
|
-
return _super.apply(this, arguments);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
(0, _createClass2["default"])(RawLine, [{
|
|
69
|
-
key: "render",
|
|
70
|
-
value: function render() {
|
|
71
|
-
var _this$props = this.props,
|
|
72
|
-
graphProps = _this$props.graphProps,
|
|
73
|
-
classes = _this$props.classes,
|
|
74
|
-
from = _this$props.from,
|
|
75
|
-
to = _this$props.to,
|
|
76
|
-
className = _this$props.className,
|
|
77
|
-
disabled = _this$props.disabled,
|
|
78
|
-
correctness = _this$props.correctness,
|
|
79
|
-
rest = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
|
|
80
|
-
var scale = graphProps.scale;
|
|
81
|
-
return /*#__PURE__*/_react["default"].createElement("line", (0, _extends2["default"])({
|
|
82
|
-
x1: scale.x(from.x),
|
|
83
|
-
y1: scale.y(from.y),
|
|
84
|
-
x2: scale.x(to.x),
|
|
85
|
-
y2: scale.y(to.y),
|
|
86
|
-
className: (0, _classnames["default"])(classes.line, disabled && classes.disabledSecondary, className, classes[correctness])
|
|
87
|
-
}, rest));
|
|
88
|
-
}
|
|
89
|
-
}]);
|
|
90
|
-
return RawLine;
|
|
91
|
-
}(_react["default"].Component);
|
|
92
|
-
|
|
93
|
-
(0, _defineProperty2["default"])(RawLine, "propTypes", {
|
|
94
|
-
className: _propTypes["default"].string,
|
|
95
|
-
classes: _propTypes["default"].object,
|
|
96
|
-
from: _plot.types.PointType,
|
|
97
|
-
to: _plot.types.PointType,
|
|
98
|
-
graphProps: _plot.types.GraphPropsType.isRequired,
|
|
99
|
-
disabled: _propTypes["default"].bool,
|
|
100
|
-
correctness: _propTypes["default"].string
|
|
101
|
-
});
|
|
102
|
-
(0, _defineProperty2["default"])(RawLine, "defaultProps", {
|
|
103
|
-
from: {},
|
|
104
|
-
to: {}
|
|
105
|
-
});
|
|
106
|
-
var Line = (0, _styles.withStyles)(function () {
|
|
107
|
-
return {
|
|
108
|
-
line: {
|
|
109
|
-
strokeWidth: 3,
|
|
110
|
-
transition: 'stroke-width 200ms ease-in, stroke 200ms ease-in',
|
|
111
|
-
stroke: 'transparent',
|
|
112
|
-
'&:hover': {
|
|
113
|
-
strokeWidth: 4,
|
|
114
|
-
stroke: _index.color.defaults.BLACK
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
disabled: _objectSpread(_objectSpread({}, (0, _styles2.disabled)('stroke')), {}, {
|
|
118
|
-
strokeWidth: 2
|
|
119
|
-
}),
|
|
120
|
-
disabledSecondary: _objectSpread(_objectSpread({}, (0, _styles2.disabledSecondary)('stroke')), {}, {
|
|
121
|
-
strokeWidth: 2
|
|
122
|
-
}),
|
|
123
|
-
correct: (0, _styles2.correct)('stroke'),
|
|
124
|
-
incorrect: (0, _styles2.incorrect)('stroke'),
|
|
125
|
-
missing: _objectSpread(_objectSpread({}, (0, _styles2.missing)('stroke')), {}, {
|
|
126
|
-
strokeWidth: 1,
|
|
127
|
-
strokeDasharray: '4 3'
|
|
128
|
-
})
|
|
129
|
-
};
|
|
130
|
-
})(RawLine);
|
|
131
|
-
exports.Line = Line;
|
|
132
|
-
|
|
133
|
-
var _default = (0, _plot.gridDraggable)({
|
|
134
|
-
bounds: function bounds(props, _ref) {
|
|
135
|
-
var domain = _ref.domain,
|
|
136
|
-
range = _ref.range;
|
|
137
|
-
var from = props.from,
|
|
138
|
-
to = props.to;
|
|
139
|
-
var area = utils.lineToArea(from, to);
|
|
140
|
-
return utils.bounds(area, domain, range);
|
|
141
|
-
},
|
|
142
|
-
anchorPoint: function anchorPoint(props) {
|
|
143
|
-
var from = props.from;
|
|
144
|
-
return from;
|
|
145
|
-
},
|
|
146
|
-
fromDelta: function fromDelta(props, delta) {
|
|
147
|
-
var from = props.from,
|
|
148
|
-
to = props.to;
|
|
149
|
-
return {
|
|
150
|
-
from: utils.point(from).add(utils.point(delta)),
|
|
151
|
-
to: utils.point(to).add(utils.point(delta))
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
})(Line);
|
|
155
|
-
|
|
156
|
-
exports["default"] = _default;
|
|
157
|
-
//# sourceMappingURL=line.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/tools/polygon/line.jsx"],"names":["RawLine","props","graphProps","classes","from","to","className","disabled","correctness","rest","scale","x","y","line","disabledSecondary","React","Component","PropTypes","string","object","types","PointType","GraphPropsType","isRequired","bool","Line","strokeWidth","transition","stroke","color","defaults","BLACK","correct","incorrect","missing","strokeDasharray","bounds","domain","range","area","utils","lineToArea","anchorPoint","fromDelta","delta","point","add"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;IAEMA,O;;;;;;;;;;;;WAgBJ,kBAAS;AACP,wBAAqF,KAAKC,KAA1F;AAAA,UAAQC,UAAR,eAAQA,UAAR;AAAA,UAAoBC,OAApB,eAAoBA,OAApB;AAAA,UAA6BC,IAA7B,eAA6BA,IAA7B;AAAA,UAAmCC,EAAnC,eAAmCA,EAAnC;AAAA,UAAuCC,SAAvC,eAAuCA,SAAvC;AAAA,UAAkDC,QAAlD,eAAkDA,QAAlD;AAAA,UAA4DC,WAA5D,eAA4DA,WAA5D;AAAA,UAA4EC,IAA5E;AACA,UAAQC,KAAR,GAAkBR,UAAlB,CAAQQ,KAAR;AACA,0BACE;AACE,QAAA,EAAE,EAAEA,KAAK,CAACC,CAAN,CAAQP,IAAI,CAACO,CAAb,CADN;AAEE,QAAA,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AZ,EAAgByC,GAAhB,CAAoBN,KAAK,CAACK,KAAN,CAAYD,KAAZ,CAApB;AAFC,KAAP;AAID;AAhB0B,CAAd,EAiBZnB,IAjBY,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { types, gridDraggable } from '@pie-lib/plot';\nimport { color } from '../../../../render-ui/src/index';\nimport * as utils from '../../utils';\nimport classNames from 'classnames';\nimport { correct, disabled, disabledSecondary, incorrect, missing } from '../shared/styles';\n\nclass RawLine extends React.Component {\n static propTypes = {\n className: PropTypes.string,\n classes: PropTypes.object,\n from: types.PointType,\n to: types.PointType,\n graphProps: types.GraphPropsType.isRequired,\n disabled: PropTypes.bool,\n correctness: PropTypes.string,\n };\n\n static defaultProps = {\n from: {},\n to: {},\n };\n\n render() {\n const { graphProps, classes, from, to, className, disabled, correctness, ...rest } = this.props;\n const { scale } = graphProps;\n return (\n <line\n x1={scale.x(from.x)}\n y1={scale.y(from.y)}\n x2={scale.x(to.x)}\n y2={scale.y(to.y)}\n className={classNames(classes.line, disabled && classes.disabledSecondary, className, classes[correctness])}\n {...rest}\n />\n );\n }\n}\n\nexport const Line = withStyles(() => ({\n line: {\n strokeWidth: 3,\n transition: 'stroke-width 200ms ease-in, stroke 200ms ease-in',\n stroke: 'transparent',\n '&:hover': {\n strokeWidth: 4,\n stroke: color.defaults.BLACK,\n },\n },\n disabled: {\n ...disabled('stroke'),\n strokeWidth: 2,\n },\n disabledSecondary: {\n ...disabledSecondary('stroke'),\n strokeWidth: 2,\n },\n correct: correct('stroke'),\n incorrect: incorrect('stroke'),\n missing: {\n ...missing('stroke'),\n strokeWidth: 1,\n strokeDasharray: '4 3',\n },\n}))(RawLine);\n\nexport default gridDraggable({\n bounds: (props, { domain, range }) => {\n const { from, to } = props;\n const area = utils.lineToArea(from, to);\n return utils.bounds(area, domain, range);\n },\n anchorPoint: (props) => {\n const { from } = props;\n return from;\n },\n fromDelta: (props, delta) => {\n const { from, to } = props;\n return {\n from: utils.point(from).add(utils.point(delta)),\n to: utils.point(to).add(utils.point(delta)),\n };\n },\n})(Line);\n"],"file":"line.js"}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports.getPointString = exports["default"] = exports.RawPolygon = exports.Polygon = void 0;
|
|
11
|
-
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
-
|
|
16
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
-
|
|
18
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
-
|
|
20
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
-
|
|
22
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
-
|
|
24
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
-
|
|
26
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
-
|
|
28
|
-
var _react = _interopRequireDefault(require("react"));
|
|
29
|
-
|
|
30
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
31
|
-
|
|
32
|
-
var _styles = require("@material-ui/core/styles");
|
|
33
|
-
|
|
34
|
-
var _plot = require("@pie-lib/plot");
|
|
35
|
-
|
|
36
|
-
var utils = _interopRequireWildcard(require("../../utils"));
|
|
37
|
-
|
|
38
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
39
|
-
|
|
40
|
-
var _index = require("./../../shared/index");
|
|
41
|
-
|
|
42
|
-
var _colorManipulator = require("@material-ui/core/styles/colorManipulator");
|
|
43
|
-
|
|
44
|
-
var _styles2 = require("../shared/styles");
|
|
45
|
-
|
|
46
|
-
var _excluded = ["points", "classes", "className", "disabled", "correctness", "graphProps", "closed"];
|
|
47
|
-
|
|
48
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
49
|
-
|
|
50
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
51
|
-
|
|
52
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
53
|
-
|
|
54
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
55
|
-
|
|
56
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
57
|
-
|
|
58
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
59
|
-
|
|
60
|
-
var getPointString = function getPointString(points, scale) {
|
|
61
|
-
return (points || []).map(function (p) {
|
|
62
|
-
var scaledPoint = {
|
|
63
|
-
x: scale.x(p.x),
|
|
64
|
-
y: scale.y(p.y)
|
|
65
|
-
};
|
|
66
|
-
return "".concat(scaledPoint.x, ",").concat(scaledPoint.y);
|
|
67
|
-
}).join(' ');
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
exports.getPointString = getPointString;
|
|
71
|
-
|
|
72
|
-
var RawPolygon = /*#__PURE__*/function (_React$Component) {
|
|
73
|
-
(0, _inherits2["default"])(RawPolygon, _React$Component);
|
|
74
|
-
|
|
75
|
-
var _super = _createSuper(RawPolygon);
|
|
76
|
-
|
|
77
|
-
function RawPolygon() {
|
|
78
|
-
(0, _classCallCheck2["default"])(this, RawPolygon);
|
|
79
|
-
return _super.apply(this, arguments);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
(0, _createClass2["default"])(RawPolygon, [{
|
|
83
|
-
key: "render",
|
|
84
|
-
value: function render() {
|
|
85
|
-
var _this$props = this.props,
|
|
86
|
-
points = _this$props.points,
|
|
87
|
-
classes = _this$props.classes,
|
|
88
|
-
className = _this$props.className,
|
|
89
|
-
disabled = _this$props.disabled,
|
|
90
|
-
correctness = _this$props.correctness,
|
|
91
|
-
graphProps = _this$props.graphProps,
|
|
92
|
-
closed = _this$props.closed,
|
|
93
|
-
rest = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
|
|
94
|
-
var scale = graphProps.scale;
|
|
95
|
-
var pointString = getPointString(points, scale);
|
|
96
|
-
var Tag = closed ? 'polygon' : 'polyline';
|
|
97
|
-
return /*#__PURE__*/_react["default"].createElement(Tag, (0, _extends2["default"])({
|
|
98
|
-
points: pointString,
|
|
99
|
-
className: (0, _classnames["default"])(closed && classes.closed, !closed && classes.open, disabled && classes.disabled, classes[correctness], className)
|
|
100
|
-
}, rest));
|
|
101
|
-
}
|
|
102
|
-
}]);
|
|
103
|
-
return RawPolygon;
|
|
104
|
-
}(_react["default"].Component);
|
|
105
|
-
|
|
106
|
-
exports.RawPolygon = RawPolygon;
|
|
107
|
-
(0, _defineProperty2["default"])(RawPolygon, "propTypes", {
|
|
108
|
-
classes: _propTypes["default"].object,
|
|
109
|
-
className: _propTypes["default"].string,
|
|
110
|
-
disabled: _propTypes["default"].bool,
|
|
111
|
-
points: _propTypes["default"].arrayOf(_plot.types.PointType),
|
|
112
|
-
graphProps: _plot.types.GraphPropsType.isRequired,
|
|
113
|
-
closed: _propTypes["default"].bool.isRequired,
|
|
114
|
-
correctness: _propTypes["default"].string
|
|
115
|
-
});
|
|
116
|
-
(0, _defineProperty2["default"])(RawPolygon, "defaultProps", {
|
|
117
|
-
points: []
|
|
118
|
-
});
|
|
119
|
-
var Polygon = (0, _styles.withStyles)(function (theme) {
|
|
120
|
-
return {
|
|
121
|
-
closed: {
|
|
122
|
-
fill: (0, _colorManipulator.fade)(theme.palette.primary.light, 0.2),
|
|
123
|
-
// TODO hardcoded color
|
|
124
|
-
strokeWidth: 2,
|
|
125
|
-
stroke: _index.color.defaults.BLACK
|
|
126
|
-
},
|
|
127
|
-
open: {
|
|
128
|
-
fill: (0, _colorManipulator.fade)(theme.palette.primary.light, 0.0),
|
|
129
|
-
// TODO hardcoded color
|
|
130
|
-
strokeWidth: 2,
|
|
131
|
-
stroke: _index.color.defaults.BLACK,
|
|
132
|
-
pointerEvents: 'none'
|
|
133
|
-
},
|
|
134
|
-
disabled: _objectSpread({}, (0, _styles2.disabled)('stroke')),
|
|
135
|
-
correct: _objectSpread({}, (0, _styles2.correct)('stroke')),
|
|
136
|
-
incorrect: _objectSpread({}, (0, _styles2.incorrect)('stroke')),
|
|
137
|
-
missing: _objectSpread(_objectSpread({}, (0, _styles2.missing)('stroke')), {}, {
|
|
138
|
-
stroke: 'inherit'
|
|
139
|
-
})
|
|
140
|
-
};
|
|
141
|
-
})(RawPolygon);
|
|
142
|
-
exports.Polygon = Polygon;
|
|
143
|
-
|
|
144
|
-
var _default = (0, _plot.gridDraggable)({
|
|
145
|
-
bounds: function bounds(props, _ref) {
|
|
146
|
-
var domain = _ref.domain,
|
|
147
|
-
range = _ref.range;
|
|
148
|
-
var points = props.points;
|
|
149
|
-
var area = utils.polygonToArea(points);
|
|
150
|
-
return utils.bounds(area, domain, range);
|
|
151
|
-
},
|
|
152
|
-
anchorPoint: function anchorPoint(props) {
|
|
153
|
-
var points = props.points;
|
|
154
|
-
return points[0];
|
|
155
|
-
},
|
|
156
|
-
fromDelta: function fromDelta(props, delta) {
|
|
157
|
-
var points = props.points;
|
|
158
|
-
return points.map(function (p) {
|
|
159
|
-
return utils.point(p).add(utils.point(delta));
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
})(Polygon);
|
|
163
|
-
|
|
164
|
-
exports["default"] = _default;
|
|
165
|
-
//# sourceMappingURL=polygon.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/tools/polygon/polygon.jsx"],"names":["getPointString","points","scale","map","p","scaledPoint","x","y","join","RawPolygon","props","classes","className","disabled","correctness","graphProps","closed","rest","pointString","Tag","open","React","Component","PropTypes","object","string","bool","arrayOf","types","PointType","GraphPropsType","isRequired","Polygon","theme","fill","palette","primary","light","strokeWidth","stroke","color","defaults","BLACK","pointerEvents","correct","incorrect","missing","bounds","domain","range","area","utils","polygonToArea","anchorPoint","fromDelta","delta","point","add"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;AAEO,IAAMA,cAAc,GAAG,SAAjBA,cAAiB,CAACC,MAAD,EAASC,KAAT,EAAmB;AAC/C,SAAO,CAACD,MAAM,IAAI,EAAX,EACJE,GADI,CACA,UAACC,CAAD,EAAO;AACV,QAAMC,WAAW,GAAG;AAClBC,MAAAA,CAAC,EAAEJ,KAAK,CAACI,CAAN,CAAQF,CAAC,CAACE,CAAV,CADe;AAElBC,MAAAA,CAAC,EAAEL,KAAK,CAACK,CAAN,CAAQH,CAAC,CAACG,CAAV;AAFe,KAApB;AAIA,qBAAUF,WAAW,CAACC,CAAtB,cAA2BD,WAAW,CAACE,CAAvC;AACD,GAPI,EAQJC,IARI,CAQC,GARD,CAAP;AASD,CAVM;;;;IAYMC,U;;;;;;;;;;;;WAeX,kBAAS;AACP,wBAA2F,KAAKC,KAAhG;AAAA,UAAQT,MAAR,eAAQA,MAAR;AAAA,UAAgBU,OAAhB,eAAgBA,OAAhB;AAAA,UAAyBC,SAAzB,eAAyBA,SAAzB;AAAA,UAAoCC,QAApC,eAAoCA,QAApC;AAAA,UAA8CC,WAA9C,eAA8CA,WAA9C;AAAA,UAA2DC,UAA3D,eAA2DA,UAA3D;AAAA,UAAuEC,MAAvE,eAAuEA,MAAvE;AAAA,UAAkFC,IAAlF;AACA,UA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,CAAmBN,KAAK,CAACK,KAAN,CAAYD,KAAZ,CAAnB,CAAP;AAAA,KAAX,CAAP;AACD;AAd0B,CAAd,EAeZvB,OAfY,C","sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport { gridDraggable, types } from '@pie-lib/plot';\nimport * as utils from '../../utils';\nimport classNames from 'classnames';\nimport { color } from '../../../../render-ui/src/index';\nimport { fade } from '@material-ui/core/styles/colorManipulator';\nimport { correct, disabled, incorrect, missing } from '../shared/styles';\n\nexport const getPointString = (points, scale) => {\n return (points || [])\n .map((p) => {\n const scaledPoint = {\n x: scale.x(p.x),\n y: scale.y(p.y),\n };\n return `${scaledPoint.x},${scaledPoint.y}`;\n })\n .join(' ');\n};\n\nexport class RawPolygon extends React.Component {\n static propTypes = {\n classes: PropTypes.object,\n className: PropTypes.string,\n disabled: PropTypes.bool,\n points: PropTypes.arrayOf(types.PointType),\n graphProps: types.GraphPropsType.isRequired,\n closed: PropTypes.bool.isRequired,\n correctness: PropTypes.string,\n };\n\n static defaultProps = {\n points: [],\n };\n\n render() {\n const { points, classes, className, disabled, correctness, graphProps, closed, ...rest } = this.props;\n const { scale } = graphProps;\n\n const pointString = getPointString(points, scale);\n const Tag = closed ? 'polygon' : 'polyline';\n return (\n <Tag\n points={pointString}\n className={classNames(\n closed && classes.closed,\n !closed && classes.open,\n disabled && classes.disabled,\n classes[correctness],\n className,\n )}\n {...rest}\n />\n );\n }\n}\n\nexport const Polygon = withStyles((theme) => ({\n closed: {\n fill: fade(theme.palette.primary.light, 0.2), // TODO hardcoded color\n strokeWidth: 2,\n stroke: color.defaults.BLACK,\n },\n open: {\n fill: fade(theme.palette.primary.light, 0.0), // TODO hardcoded color\n strokeWidth: 2,\n stroke: color.defaults.BLACK,\n pointerEvents: 'none',\n },\n disabled: {\n ...disabled('stroke'),\n },\n correct: {\n ...correct('stroke'),\n },\n incorrect: {\n ...incorrect('stroke'),\n },\n missing: {\n ...missing('stroke'),\n stroke: 'inherit',\n },\n}))(RawPolygon);\n\nexport default gridDraggable({\n bounds: (props, { domain, range }) => {\n const { points } = props;\n const area = utils.polygonToArea(points);\n return utils.bounds(area, domain, range);\n },\n anchorPoint: (props) => {\n const { points } = props;\n return points[0];\n },\n fromDelta: (props, delta) => {\n const { points } = props;\n\n return points.map((p) => utils.point(p).add(utils.point(delta)));\n },\n})(Polygon);\n"],"file":"polygon.js"}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = exports.RayLine = void 0;
|
|
9
|
-
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
-
|
|
14
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
-
|
|
16
|
-
var _line = require("../shared/line");
|
|
17
|
-
|
|
18
|
-
var _react = _interopRequireDefault(require("react"));
|
|
19
|
-
|
|
20
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
21
|
-
|
|
22
|
-
var _arrowHead = require("../shared/arrow-head");
|
|
23
|
-
|
|
24
|
-
var _plot = require("@pie-lib/plot");
|
|
25
|
-
|
|
26
|
-
var _styles = require("@material-ui/core/styles");
|
|
27
|
-
|
|
28
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
29
|
-
|
|
30
|
-
var _utils = require("../../utils");
|
|
31
|
-
|
|
32
|
-
var _excluded = ["graphProps", "from", "to", "classes", "disabled", "correctness", "className"];
|
|
33
|
-
|
|
34
|
-
var rayStyles = function rayStyles(theme) {
|
|
35
|
-
return {
|
|
36
|
-
line: _line.styles.line(theme),
|
|
37
|
-
enabledArrow: _line.styles.arrow(theme),
|
|
38
|
-
disabledArrow: _line.styles.disabledArrow(theme),
|
|
39
|
-
disabled: _line.styles.disabled(theme),
|
|
40
|
-
disabledSecondary: _line.styles.disabledSecondary(theme),
|
|
41
|
-
correct: _line.styles.correct(theme, 'stroke'),
|
|
42
|
-
correctArrow: _line.styles.correct(theme),
|
|
43
|
-
incorrect: _line.styles.incorrect(theme, 'stroke'),
|
|
44
|
-
incorrectArrow: _line.styles.incorrect(theme),
|
|
45
|
-
missing: _line.styles.missing(theme, 'stroke'),
|
|
46
|
-
missingArrow: _line.styles.missing(theme)
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
var RayLine = function RayLine(props) {
|
|
51
|
-
var markerId = (0, _arrowHead.genUid)();
|
|
52
|
-
var graphProps = props.graphProps,
|
|
53
|
-
from = props.from,
|
|
54
|
-
to = props.to,
|
|
55
|
-
classes = props.classes,
|
|
56
|
-
disabled = props.disabled,
|
|
57
|
-
correctness = props.correctness,
|
|
58
|
-
className = props.className,
|
|
59
|
-
rest = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
60
|
-
var scale = graphProps.scale;
|
|
61
|
-
|
|
62
|
-
var _getAdjustedGraphLimi = (0, _utils.getAdjustedGraphLimits)(graphProps),
|
|
63
|
-
domain = _getAdjustedGraphLimi.domain,
|
|
64
|
-
range = _getAdjustedGraphLimi.range;
|
|
65
|
-
|
|
66
|
-
var _trig$edges = _plot.trig.edges(domain, range)(from, to),
|
|
67
|
-
_trig$edges2 = (0, _slicedToArray2["default"])(_trig$edges, 1),
|
|
68
|
-
aToB = _trig$edges2[0];
|
|
69
|
-
|
|
70
|
-
var suffix = correctness || disabled && 'disabled' || 'enabled';
|
|
71
|
-
return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement(_arrowHead.ArrowMarker, {
|
|
72
|
-
size: (0, _utils.thinnerShapesNeeded)(graphProps) ? 4 : 5,
|
|
73
|
-
id: "".concat(props.markerId || markerId, "-").concat(suffix),
|
|
74
|
-
className: (0, _classnames["default"])(classes["".concat(suffix, "Arrow")])
|
|
75
|
-
})), /*#__PURE__*/_react["default"].createElement("line", (0, _extends2["default"])({
|
|
76
|
-
x1: scale.x(from.x),
|
|
77
|
-
y1: scale.y(from.y),
|
|
78
|
-
x2: scale.x(aToB.x),
|
|
79
|
-
y2: scale.y(aToB.y)
|
|
80
|
-
}, rest, {
|
|
81
|
-
className: (0, _classnames["default"])(classes.line, disabled && classes.disabledSecondary, classes[correctness], className),
|
|
82
|
-
markerEnd: "url(#".concat(props.markerId || markerId, "-").concat(suffix, ")")
|
|
83
|
-
})));
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
exports.RayLine = RayLine;
|
|
87
|
-
RayLine.propTypes = {
|
|
88
|
-
classes: _propTypes["default"].object,
|
|
89
|
-
className: _propTypes["default"].string,
|
|
90
|
-
disabled: _propTypes["default"].bool,
|
|
91
|
-
correctness: _propTypes["default"].string,
|
|
92
|
-
graphProps: _propTypes["default"].any,
|
|
93
|
-
from: _plot.types.PointType,
|
|
94
|
-
to: _plot.types.PointType,
|
|
95
|
-
markerId: _propTypes["default"].string
|
|
96
|
-
};
|
|
97
|
-
var StyledRay = (0, _styles.withStyles)(rayStyles)(RayLine);
|
|
98
|
-
var Ray = (0, _line.lineBase)(StyledRay);
|
|
99
|
-
var Component = (0, _line.lineToolComponent)(Ray);
|
|
100
|
-
var _default = Component;
|
|
101
|
-
exports["default"] = _default;
|
|
102
|
-
//# sourceMappingURL=component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/tools/ray/component.jsx"],"names":["rayStyles","theme","line","styles","enabledArrow","arrow","disabledArrow","disabled","disabledSecondary","correct","correctArrow","incorrect","incorrectArrow","missing","missingArrow","RayLine","props","markerId","graphProps","from","to","classes","correctness","className","rest","scale","domain","range","trig","edges","aToB","suffix","x","y","propTypes","PropTypes","object","string","bool","any","types","PointType","StyledRay","Ray","Component"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAEA,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAACC,KAAD;AAAA,SAAY;AAC5BC,IAAAA,IAAI,EAAEC,aAAOD,IAAP,CAAYD,KAAZ,CADsB;AAE5BG,IAAAA,YAAY,EAAED,aAAOE,KAAP,CAAaJ,KAAb,CAFc;AAG5BK,IAAAA,aAAa,EAAEH,aAAOG,aAAP,CAAqBL,KAArB,CAHa;AAI5BM,IAAAA,QAAQ,EAAEJ,aAAOI,QAAP,CAAgBN,KAAhB,CAJkB;AAK5BO,IAAAA,iBAAiB,EAAEL,aAAOK,iBAAP,CAAyBP,KAAzB,CALS;AAM5BQ,IAAAA,OAAO,EAAEN,aAAOM,OAAP,CAAeR,KAAf,EAAsB,QAAtB,CANmB;AAO5BS,IAAAA,YAAY,EAAEP,aAAOM,OAAP,CAAeR,KAAf,CAPc;AAQ5BU,IAAAA,SAAS,EAAER,aAAOQ,SAAP,CAAiBV,KAAjB,EAAwB,QAAxB,CARiB;AAS5BW,IAAAA,cAAc,EAAET,aAAOQ,SAAP,CAAiBV,KAAjB,CATY;AAU5BY,IAAAA,OAAO,EAAEV,aAAOU,OAAP,CAAeZ,KAAf,EAAsB,QAAtB,CAVmB;AAW5Ba,IAAAA,YAAY,EAAEX,aAAOU,OAAP,CAAeZ,KAAf;AAXc,GAAZ;AAAA,CAAlB;;AAcO,IAAMc,OAAO,GAAG,SAAVA,OAAU,CAACC,KAAD,EAAW;AAChC,MAAMC,QAAQ,GAAG,wBAAjB;AACA,MAAQC,UAAR,GAAqFF,KAArF,CAAQE,UAAR;AAAA,MAAoBC,IAApB,GAAqFH,KAArF,CAAoBG,IAApB;AAAA,MAA0BC,EAA1B,GAAqFJ,KAArF,CAA0BI,EAA1B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yBK,QAAQ,IAAIc,OAAO,CAACb,iBAA7C,EAAgEa,OAAO,CAACC,WAAD,CAAvE,EAAsFC,SAAtF,CANb;AAOE,IAAA,SAAS,iBAAUP,KAAK,CAACC,QAAN,IAAkBA,QAA5B,cAAwCc,MAAxC;AAPX,KARF,CADF;AAoBD,CA5BM;;;AA8BPhB,OAAO,CAACmB,SAAR,GAAoB;AAClBb,EAAAA,OAAO,EAAEc,sBAAUC,MADD;AAElBb,EAAAA,SAAS,EAAEY,sBAAUE,MAFH;AAGlB9B,EAAAA,QAAQ,EAAE4B,sBAAUG,IAHF;AAIlBhB,EAAAA,WAAW,EAAEa,sBAAUE,MAJL;AAKlBnB,EAAAA,UAAU,EAAEiB,sBAAUI,GALJ;AAMlBpB,EAAAA,IAAI,EAAEqB,YAAMC,SANM;AAOlBrB,EAAAA,EAAE,EAAEoB,YAAMC,SAPQ;AAQlBxB,EAAAA,QAAQ,EAAEkB,sBAAUE;AARF,CAApB;AAWA,IAAMK,SAAS,GAAG,wBAAW1C,SAAX,EAAsBe,OAAtB,CAAlB;AAEA,IAAM4B,GAAG,GAAG,oBAASD,SAAT,CAAZ;AACA,IAAME,SAAS,GAAG,6BAAkBD,GAAlB,CAAlB;eAEeC,S","sourcesContent":["import { lineToolComponent, lineBase, styles } from '../shared/line';\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport { ArrowMarker, genUid } from '../shared/arrow-head';\nimport { trig, types } from '@pie-lib/plot';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\nimport { thinnerShapesNeeded, getAdjustedGraphLimits } from '../../utils';\n\nconst rayStyles = (theme) => ({\n line: styles.line(theme),\n enabledArrow: styles.arrow(theme),\n disabledArrow: styles.disabledArrow(theme),\n disabled: styles.disabled(theme),\n disabledSecondary: styles.disabledSecondary(theme),\n correct: styles.correct(theme, 'stroke'),\n correctArrow: styles.correct(theme),\n incorrect: styles.incorrect(theme, 'stroke'),\n incorrectArrow: styles.incorrect(theme),\n missing: styles.missing(theme, 'stroke'),\n missingArrow: styles.missing(theme),\n});\n\nexport const RayLine = (props) => {\n const markerId = genUid();\n const { graphProps, from, to, classes, disabled, correctness, className, ...rest } = props;\n const { scale } = graphProps;\n const { domain, range } = getAdjustedGraphLimits(graphProps);\n const [aToB] = trig.edges(domain, range)(from, to);\n const suffix = correctness || (disabled && 'disabled') || 'enabled';\n\n return (\n <g>\n <defs>\n <ArrowMarker\n size={thinnerShapesNeeded(graphProps) ? 4 : 5}\n id={`${props.markerId || markerId}-${suffix}`}\n className={classNames(classes[`${suffix}Arrow`])}\n />\n </defs>\n <line\n x1={scale.x(from.x)}\n y1={scale.y(from.y)}\n x2={scale.x(aToB.x)}\n y2={scale.y(aToB.y)}\n {...rest}\n className={classNames(classes.line, disabled && classes.disabledSecondary, classes[correctness], className)}\n markerEnd={`url(#${props.markerId || markerId}-${suffix})`}\n />\n </g>\n );\n};\n\nRayLine.propTypes = {\n classes: PropTypes.object,\n className: PropTypes.string,\n disabled: PropTypes.bool,\n correctness: PropTypes.string,\n graphProps: PropTypes.any,\n from: types.PointType,\n to: types.PointType,\n markerId: PropTypes.string,\n};\n\nconst StyledRay = withStyles(rayStyles)(RayLine);\n\nconst Ray = lineBase(StyledRay);\nconst Component = lineToolComponent(Ray);\n\nexport default Component;\n"],"file":"component.js"}
|
package/lib/tools/ray/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.tool = void 0;
|
|
9
|
-
|
|
10
|
-
var _component = _interopRequireDefault(require("./component"));
|
|
11
|
-
|
|
12
|
-
var _line = require("../shared/line");
|
|
13
|
-
|
|
14
|
-
var tool = (0, _line.lineTool)('ray', _component["default"]);
|
|
15
|
-
exports.tool = tool;
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/tools/ray/index.js"],"names":["tool","Ray"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEO,IAAMA,IAAI,GAAG,oBAAS,KAAT,EAAgBC,qBAAhB,CAAb","sourcesContent":["import Ray from './component';\nimport { lineTool } from '../shared/line';\n\nexport const tool = lineTool('ray', Ray);\n"],"file":"index.js"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = exports.Line = void 0;
|
|
9
|
-
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
|
|
12
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
-
|
|
14
|
-
var _line = require("../shared/line");
|
|
15
|
-
|
|
16
|
-
var _react = _interopRequireDefault(require("react"));
|
|
17
|
-
|
|
18
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
-
|
|
20
|
-
var _plot = require("@pie-lib/plot");
|
|
21
|
-
|
|
22
|
-
var _styles = require("@material-ui/core/styles");
|
|
23
|
-
|
|
24
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
25
|
-
|
|
26
|
-
var _excluded = ["className", "classes", "correctness", "disabled", "graphProps", "from", "to"];
|
|
27
|
-
|
|
28
|
-
var lineStyles = function lineStyles(theme) {
|
|
29
|
-
return {
|
|
30
|
-
line: _line.styles.line(theme),
|
|
31
|
-
disabled: _line.styles.disabled(theme),
|
|
32
|
-
disabledSecondary: _line.styles.disabledSecondary(theme),
|
|
33
|
-
correct: _line.styles.correct(theme, 'stroke'),
|
|
34
|
-
incorrect: _line.styles.incorrect(theme, 'stroke'),
|
|
35
|
-
missing: _line.styles.missing(theme, 'stroke')
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
var Line = function Line(props) {
|
|
40
|
-
var className = props.className,
|
|
41
|
-
classes = props.classes,
|
|
42
|
-
correctness = props.correctness,
|
|
43
|
-
disabled = props.disabled,
|
|
44
|
-
graphProps = props.graphProps,
|
|
45
|
-
from = props.from,
|
|
46
|
-
to = props.to,
|
|
47
|
-
rest = (0, _objectWithoutProperties2["default"])(props, _excluded);
|
|
48
|
-
var scale = graphProps.scale;
|
|
49
|
-
return /*#__PURE__*/_react["default"].createElement("line", (0, _extends2["default"])({
|
|
50
|
-
stroke: "green",
|
|
51
|
-
strokeWidth: "6",
|
|
52
|
-
x1: scale.x(from.x),
|
|
53
|
-
y1: scale.y(from.y),
|
|
54
|
-
x2: scale.x(to.x),
|
|
55
|
-
y2: scale.y(to.y),
|
|
56
|
-
className: (0, _classnames["default"])(classes.line, disabled && classes.disabledSecondary, classes[correctness], className)
|
|
57
|
-
}, rest));
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
exports.Line = Line;
|
|
61
|
-
Line.propTypes = {
|
|
62
|
-
className: _propTypes["default"].string,
|
|
63
|
-
classes: _propTypes["default"].object,
|
|
64
|
-
correctness: _propTypes["default"].string,
|
|
65
|
-
disabled: _propTypes["default"].bool,
|
|
66
|
-
graphProps: _propTypes["default"].any,
|
|
67
|
-
from: _plot.types.PointType,
|
|
68
|
-
to: _plot.types.PointType
|
|
69
|
-
};
|
|
70
|
-
var StyledLine = (0, _styles.withStyles)(lineStyles)(Line);
|
|
71
|
-
var Segment = (0, _line.lineBase)(StyledLine);
|
|
72
|
-
var Component = (0, _line.lineToolComponent)(Segment);
|
|
73
|
-
var _default = Component;
|
|
74
|
-
exports["default"] = _default;
|
|
75
|
-
//# sourceMappingURL=component.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/tools/segment/component.jsx"],"names":["lineStyles","theme","line","styles","disabled","disabledSecondary","correct","incorrect","missing","Line","props","className","classes","correctness","graphProps","from","to","rest","scale","x","y","propTypes","PropTypes","string","object","bool","any","types","PointType","StyledLine","Segment","Component"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;AAEA,IAAMA,UAAU,GAAG,SAAbA,UAAa,CAACC,KAAD;AAAA,SAAY;AAC7BC,IAAAA,IAAI,EAAEC,aAAOD,IAAP,CAAYD,KAAZ,CADuB;AAE7BG,IAAAA,QAAQ,EAAED,aAAOC,QAAP,CAAgBH,KAAhB,CAFmB;AAG7BI,IAAAA,iBAAiB,EAAEF,aAAOE,iBAAP,CAAyBJ,KAAzB,CAHU;AAI7BK,IAAAA,OAAO,EAAEH,aAAOG,OAAP,CAAeL,KAAf,EAAsB,QAAtB,CAJoB;AAK7BM,IAAAA,SAAS,EAAEJ,aAAOI,SAAP,CAAiBN,KAAjB,EAAwB,QAAxB,CALkB;AAM7BO,IAAAA,OAAO,EAAEL,aAAOK,OAAP,CAAeP,KAAf,EAAsB,QAAtB;AANoB,GAAZ;AAAA,CAAnB;;AAQO,IAAMQ,IAAI,GAAG,SAAPA,IAAO,CAACC,KAAD,EAAW;AAC7B,MAAQC,SAAR,GAAqFD,KAArF,CAAQC,SAAR;AAAA,MAAmBC,OAAnB,GAAqFF,KAArF,CAAmBE,OAAnB;AAAA,MAA4BC,WAA5B,GAAqFH,KAArF,CAA4BG,WAA5B;AAAA,MAAyCT,QAAzC,GAAqFM,KAArF,CAAyCN,QAAzC;AAAA,MAAmDU,UAAnD,GAAqFJ,KAArF,CAAmDI,UAAnD;AAAA,MAA+DC,IAA/D,GAAqFL,KAArF,CAA+DK,IAA/D;AAAA,MAAqEC,EAArE,GAAqFN,KAArF,CAAqEM,EAArE;AAAA,MAA4EC,IAA5E,6CAAqFP,KAArF;AACA,MAAQQ,KAAR,GAAkBJ,UAAlB,CAAQI,KAAR;AAEA,sBACE;AACE,IAAA,MAAM,EAAC,OADT;AAEE,IAAA,WAAW,EAAC,GAFd;AAGE,IAAA,EAAE,EAAEA,KAAK,CAACC,CAAN,CAAQJ,IAAI,CAACI,CAAb,CAHN;AAIE,IAAA,EAAE,EAAED,KAAK,CAACE,CAAN,CAAQL,IAAI,CAACK,CAAb,CAJN;AAKE,IAAA,EAAE,EAAEF,KAAK,CAACC,CAAN,CAAQH,EAAE,CAACG,CAAX,CALN;AAME,IAAA,EAAE,EAAED,KAAK,CAACE,CAAN,CAAQJ,EAAE,CAACI,CAAX,CANN;AAOE,IAAA,SAAS,EAAE,4BAAWR,OAAO,CAACV,IAAnB,EAAyBE,QAAQ,IAAIQ,OAAO,CAACP,iBAA7C,EAAgEO,OAAO,CAACC,WAAD,CAAvE,EAAsFF,SAAtF;AAPb,KAQMM,IARN,EADF;AAYD,CAhBM;;;AAkBPR,IAAI,CAACY,SAAL,GAAiB;AACfV,EAAAA,SAAS,EAAEW,sBAAUC,MADN;AAEfX,EAAAA,OAAO,EAAEU,sBAAUE,MAFJ;AAGfX,EAAAA,WAAW,EAAES,sBAAUC,MAHR;AAIfnB,EAAAA,QAAQ,EAAEkB,sBAAUG,IAJL;AAKfX,EAAAA,UAAU,EAAEQ,sBAAUI,GALP;AAMfX,EAAAA,IAAI,EAAEY,YAAMC,SANG;AAOfZ,EAAAA,EAAE,EAAEW,YAAMC;AAPK,CAAjB;AAUA,IAAMC,UAAU,GAAG,wBAAW7B,UAAX,EAAuBS,IAAvB,CAAnB;AACA,IAAMqB,OAAO,GAAG,oBAASD,UAAT,CAAhB;AACA,IAAME,SAAS,GAAG,6BAAkBD,OAAlB,CAAlB;eAEeC,S","sourcesContent":["import { lineToolComponent, lineBase, styles } from '../shared/line';\nimport React from 'react';\nimport PropTypes from 'prop-types';\n\nimport { types } from '@pie-lib/plot';\nimport { withStyles } from '@material-ui/core/styles';\nimport classNames from 'classnames';\n\nconst lineStyles = (theme) => ({\n line: styles.line(theme),\n disabled: styles.disabled(theme),\n disabledSecondary: styles.disabledSecondary(theme),\n correct: styles.correct(theme, 'stroke'),\n incorrect: styles.incorrect(theme, 'stroke'),\n missing: styles.missing(theme, 'stroke'),\n});\nexport const Line = (props) => {\n const { className, classes, correctness, disabled, graphProps, from, to, ...rest } = props;\n const { scale } = graphProps;\n\n return (\n <line\n stroke=\"green\"\n strokeWidth=\"6\"\n x1={scale.x(from.x)}\n y1={scale.y(from.y)}\n x2={scale.x(to.x)}\n y2={scale.y(to.y)}\n className={classNames(classes.line, disabled && classes.disabledSecondary, classes[correctness], className)}\n {...rest}\n />\n );\n};\n\nLine.propTypes = {\n className: PropTypes.string,\n classes: PropTypes.object,\n correctness: PropTypes.string,\n disabled: PropTypes.bool,\n graphProps: PropTypes.any,\n from: types.PointType,\n to: types.PointType,\n};\n\nconst StyledLine = withStyles(lineStyles)(Line);\nconst Segment = lineBase(StyledLine);\nconst Component = lineToolComponent(Segment);\n\nexport default Component;\n"],"file":"component.js"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.tool = void 0;
|
|
9
|
-
|
|
10
|
-
var _component = _interopRequireDefault(require("./component"));
|
|
11
|
-
|
|
12
|
-
var _line = require("../shared/line");
|
|
13
|
-
|
|
14
|
-
var tool = (0, _line.lineTool)('segment', _component["default"]);
|
|
15
|
-
exports.tool = tool;
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/tools/segment/index.js"],"names":["tool","Segment"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEO,IAAMA,IAAI,GAAG,oBAAS,SAAT,EAAoBC,qBAApB,CAAb","sourcesContent":["import Segment from './component';\nimport { lineTool } from '../shared/line';\n\nexport const tool = lineTool('segment', Segment);\n"],"file":"index.js"}
|