clone

a browser-first diagram editor with live svg previews, local drafts and encrypted, accountless sharing

main
diagramzip / renderers / browser-run / frames / diagramsnet / vendor / assets / shapes / mxSAP.js
mxSAP.js 2.1K
1/**2 * Copyright (c) 2006-2016, JGraph Holdings Ltd3 */45//**********************************************************************************************************************************************************6//Icon7//**********************************************************************************************************************************************************8/**9* Extends mxShape.10*/11function mxSAPIconShape(bounds, fill, stroke, strokewidth)12{13 mxShape.call(this);14 this.bounds = bounds;15 this.fill = fill;16 this.stroke = stroke;17 this.strokewidth = (strokewidth != null) ? strokewidth : 1;18};1920/**21* Extends mxShape.22*/23mxUtils.extend(mxSAPIconShape, mxShape);2425mxSAPIconShape.prototype.cst = {26 ICON : 'mxgraph.sap.icon'27};2829/**30* Function: paintVertexShape31* 32* Paints the vertex shape.33*/34mxSAPIconShape.prototype.paintVertexShape = function(c, x, y, w, h)35{36 c.translate(x, y);37 this.background(c, 0, 0, w, h);38 c.setShadow(false);39 this.foreground(c, 0, 0, w, h);40};4142mxSAPIconShape.prototype.background = function(c, x, y, w, h)43{44 c.ellipse(0, 0, w, h);45 c.fillAndStroke();46};4748mxSAPIconShape.prototype.foreground = function(c, x, y, w, h)49{50 var sapIcon = mxUtils.getValue(this.style, 'SAPIcon', '');5152 c.image(w * 0.2, h * 0.2, w * 0.6, h * 0.6, GRAPH_IMAGE_PATH + '/lib/sap/' + sapIcon + '.svg'); 53};5455mxCellRenderer.registerShape(mxSAPIconShape.prototype.cst.ICON, mxSAPIconShape);5657mxSAPIconShape.prototype.getConstraints = function(style, w, h)58{59 var constr = [];6061 constr.push(new mxConnectionConstraint(new mxPoint(0.625, 0), false));62 constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));63 constr.push(new mxConnectionConstraint(new mxPoint(0.625, 1), false));64 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.325), false));65 constr.push(new mxConnectionConstraint(new mxPoint(0, 0.675), false));66 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));67 constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));68 constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));69 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));7071 return (constr);72};73