Is there any way to draw rounded selection border for select-able vertices? As we have two shapes of vertices(one is circle i.e. mxConstants.SHAPE_ELLIPSE and the other one is rounded rectangle i.e. mxConstants.SHAPE_RECTANGLE). I was going through a little bit of mxClient code to understand why rounded rectangular vertices can be drawn but why can't the selection border be drawn the same way. Then I found that color, stroke width, dashed selection border have been taken care for the selection border but not considering isRounded flag for the shape.


I could see some instance where rounded boarder has been taken care of.\n// Code snippet from mxShape.prototype.updateSvgShape = function (node)\nif (this.isRounded) {\n var r = Math.min(w * mxConstants.RECTANGLE_ROUNDING_FACTOR, h * mxConstants.RECTANGLE_ROUNDING_FACTOR);\n node.setAttribute('rx', r);\n node.setAttribute('ry', r);\n }\nPlease suggest some way to tackle the situation.

asked 29 Aug '11, 04:29

sachinshetty's gravatar image

accept rate: 0%

Override mxVertexHandler.createSelectionShape as follows:

mxVertexHandler.prototype.createSelectionShape = function(bounds)\n{\n  var shape = new mxRectangleShape(bounds, null, this.getSelectionColor());\n  shape.strokewidth = this.getSelectionStrokeWidth();\n  shape.isDashed =  this.isSelectionDashed();\n  shape.isRounded = this.state.style[mxConstants.STYLE_ROUNDED] == 1;\n\n  return shape;\n};\n

answered 29 Aug '11, 07:06

Gaudenz's gravatar image

accept rate: 39%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 29 Aug '11, 04:29

Seen: 2,439 times

Last updated: 29 Aug '11, 07:06