jmgraph 3.2.12 → 3.2.13
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/jmgraph.core.min.js +1 -1
- package/dist/jmgraph.core.min.js.map +1 -1
- package/dist/jmgraph.js +38 -5
- package/dist/jmgraph.min.js +1 -1
- package/package.json +1 -1
- package/src/core/jmControl.js +34 -2
package/dist/jmgraph.js
CHANGED
|
@@ -208,7 +208,6 @@ var _jmShadow = require("./jmShadow.js");
|
|
|
208
208
|
var _jmProperty2 = require("./jmProperty.js");
|
|
209
209
|
var _path = _interopRequireDefault(require("../lib/webgl/path.js"));
|
|
210
210
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
211
|
-
function _readOnlyError(r) { throw new TypeError('"' + r + '" is read-only'); }
|
|
212
211
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
213
212
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
214
213
|
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
@@ -276,6 +275,7 @@ var jmControl = exports.jmControl = exports["default"] = /*#__PURE__*/function (
|
|
|
276
275
|
//this.position = params.position || {x:0,y:0};
|
|
277
276
|
_this2.width = params.width || 0;
|
|
278
277
|
_this2.height = params.height || 0;
|
|
278
|
+
_this2.hitArea = params.hitArea || null;
|
|
279
279
|
//this.lockSide = params.lockSide || null;
|
|
280
280
|
|
|
281
281
|
if (params.position) {
|
|
@@ -386,6 +386,23 @@ var jmControl = exports.jmControl = exports["default"] = /*#__PURE__*/function (
|
|
|
386
386
|
return this.property('interactive', v);
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
+
/**
|
|
390
|
+
* 事件命中区域,如果不给定就会自动计算
|
|
391
|
+
* 这个区域是相对于当前控件本身的,也就是说从左上角开始 {x:0,y:0}
|
|
392
|
+
* @property hitArea
|
|
393
|
+
* @default bounds
|
|
394
|
+
* @type { x: number, y: number, width: number, height: number}
|
|
395
|
+
*/
|
|
396
|
+
}, {
|
|
397
|
+
key: "hitArea",
|
|
398
|
+
get: function get() {
|
|
399
|
+
var s = this.property('hitArea');
|
|
400
|
+
return s;
|
|
401
|
+
},
|
|
402
|
+
set: function set(v) {
|
|
403
|
+
return this.property('hitArea', v);
|
|
404
|
+
}
|
|
405
|
+
|
|
389
406
|
/**
|
|
390
407
|
* 当前控件的子控件集合
|
|
391
408
|
* @property children
|
|
@@ -1418,6 +1435,22 @@ var jmControl = exports.jmControl = exports["default"] = /*#__PURE__*/function (
|
|
|
1418
1435
|
return true;
|
|
1419
1436
|
}
|
|
1420
1437
|
var bounds = this.getBounds();
|
|
1438
|
+
// 如果指定了合中区域,则以命中区域为准
|
|
1439
|
+
if (this.hitArea) {
|
|
1440
|
+
var hitArea = {
|
|
1441
|
+
left: this.hitArea.x + bounds.left,
|
|
1442
|
+
top: this.hitArea.y + bounds.top,
|
|
1443
|
+
right: this.hitArea.width + bounds.left,
|
|
1444
|
+
bottom: this.hitArea.height + bounds.top
|
|
1445
|
+
};
|
|
1446
|
+
if (p.x > hitArea.right || p.x < hitArea.left) {
|
|
1447
|
+
return false;
|
|
1448
|
+
}
|
|
1449
|
+
if (p.y > hitArea.bottom || p.y < hitArea.top) {
|
|
1450
|
+
return false;
|
|
1451
|
+
}
|
|
1452
|
+
return true;
|
|
1453
|
+
}
|
|
1421
1454
|
var ps = this.points;
|
|
1422
1455
|
//如果不是路径组成,则采用边界做为顶点
|
|
1423
1456
|
if (!ps || !ps.length) {
|
|
@@ -1689,17 +1722,17 @@ var jmControl = exports.jmControl = exports["default"] = /*#__PURE__*/function (
|
|
|
1689
1722
|
});
|
|
1690
1723
|
if (outside.left < 0) {
|
|
1691
1724
|
//offsetx -= outside.left;
|
|
1692
|
-
0
|
|
1725
|
+
offsetx = 0;
|
|
1693
1726
|
} else if (outside.right > 0) {
|
|
1694
1727
|
//offsetx -= outside.right;
|
|
1695
|
-
0
|
|
1728
|
+
offsetx = 0;
|
|
1696
1729
|
}
|
|
1697
1730
|
if (outside.top < 0) {
|
|
1698
1731
|
//offsety -= outside.top;
|
|
1699
|
-
0
|
|
1732
|
+
offsety = 0;
|
|
1700
1733
|
} else if (outside.bottom > 0) {
|
|
1701
1734
|
//offsety -= outside.bottom;
|
|
1702
|
-
0
|
|
1735
|
+
offsety = 0;
|
|
1703
1736
|
}
|
|
1704
1737
|
}
|
|
1705
1738
|
if (offsetx || offsety) {
|