setSelected method

void setSelected (bool select)

Sets selection state, changes stroke of polyline and filling of selectionRect.

Implementation

void setSelected(bool select) {
  String stroke = attr[PyA.STROKE], fill;
  if (select) {
    strokeWidth = int.parse(attr[PyA.STROKE_WIDTH_HILITE]);
    fill = attr[PyA.STROKE];
  } else {
    strokeWidth = int.parse(attr[PyA.STROKE_WIDTH]);
    fill = "none";
  }
  _isSelected = select;

  // changing an attribute will, in svg, directly be effective
  polyline.setAttribute(SVG.STROKE_WIDTH, "$strokeWidth");

  if (selectionIcon != null)
    SVG.setAttr(selectionIcon, {SVG.STROKE: "$stroke", SVG.FILL: "$fill"});
}