From abfa05d9d8c3755a91c09574b3e3cb03b74959e8 Mon Sep 17 00:00:00 2001 From: zcy <290198252@qq.com> Date: Fri, 8 Mar 2024 00:28:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0label=E5=92=8Cpolygon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mxclient/js/shape/mxPolygon.js | 57 ++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 mxclient/js/shape/mxPolygon.js diff --git a/mxclient/js/shape/mxPolygon.js b/mxclient/js/shape/mxPolygon.js new file mode 100644 index 0000000..533a4a6 --- /dev/null +++ b/mxclient/js/shape/mxPolygon.js @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2006-2015, JGraph Ltd + * Copyright (c) 2006-2015, Gaudenz Alder + */ +/** + * Class: mxTriangle + * + * Implementation of the triangle shape. + * + * Constructor: mxTriangle + * + * Constructs a new triangle shape. + */ +function mxPolygon() +{ + mxActor.call(this); +}; + +/** + * Extends mxActor. + */ +mxUtils.extend(mxPolygon, mxActor); + +/** + * Function: isRoundable + * + * Adds roundable support. + */ +mxPolygon.prototype.isRoundable = function() +{ + return true; +}; + +// /** +// * Function: redrawPath +// * +// * Draws the path for this shape. +// */ +// mxPolygon.prototype.redrawPath = function(c, x, y, w, h) +// { +// var arcSize = mxUtils.getValue(this.style, mxConstants.STYLE_ARCSIZE, mxConstants.LINE_ARCSIZE) / 2; +// this.addPoints(c, [new mxPoint(0, 0), new mxPoint(w, 0.5 * h), new mxPoint(0, h)], this.isRounded, 23, true); +// }; + +mxPolygon.prototype.paintVertexShape = function(c, x, y, w, h) +{ + console.log(this.state.cell) + let poi = this.state.cell.points + c.begin(); + c.moveTo(x,y); + for(let i = 0;i < poi.length;i++){ + c.lineTo(poi[i].x,poi[i].y); + } + c.lineTo(x,y); + c.close() + c.fillAndStroke(); +}; \ No newline at end of file