sch_test/mxclient/js/shape/mxPolygon.js

57 lines
1.1 KiB
JavaScript

/**
* 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();
};