Files
lan-manager/web/node_modules/@antv/g-canvas/lib/shape/polygon.js
openclaw 0a5f6a8047 Initial commit: Lan-manager project code
- Go backend (server/)
- Frontend (web/, server/static/)
- Database and deployment files
- Scripts and docs

Co-Authored-By: 狸花猫/Claude-Qwen3.6-Plus 🐾
2026-04-20 00:52:58 +08:00

48 lines
1.5 KiB
JavaScript

"use strict";
/**
* @fileoverview 多边形
* @author dxq613@gmail.com
*/
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var base_1 = require("./base");
var polyline_1 = require("../util/in-stroke/polyline");
var polygon_1 = require("../util/in-path/polygon");
var Polygon = /** @class */ (function (_super) {
tslib_1.__extends(Polygon, _super);
function Polygon() {
return _super !== null && _super.apply(this, arguments) || this;
}
Polygon.prototype.isInStrokeOrPath = function (x, y, isStroke, isFill, lineWidth) {
var points = this.attr().points;
var isHit = false;
if (isStroke) {
isHit = polyline_1.default(points, lineWidth, x, y, true);
}
if (!isHit && isFill) {
isHit = polygon_1.default(points, x, y); // isPointInPath(shape, x, y);
}
return isHit;
};
Polygon.prototype.createPath = function (context) {
var attrs = this.attr();
var points = attrs.points;
if (points.length < 2) {
return;
}
context.beginPath();
for (var i = 0; i < points.length; i++) {
var point = points[i];
if (i === 0) {
context.moveTo(point[0], point[1]);
}
else {
context.lineTo(point[0], point[1]);
}
}
context.closePath();
};
return Polygon;
}(base_1.default));
exports.default = Polygon;
//# sourceMappingURL=polygon.js.map