zbSetIcon method

dynamic zbSetIcon(
  1. dynamic x,
  2. dynamic y
)

Implementation

zbSetIcon(x,y){
  String icon = style['zbStyle']['property']['setIcon'];
  String id = 'zbset$icon';
  dynamic iconSize = imageSize[id];
  double imagew = 0;
  if(style['zbStyle']['property']['width'] != null && style['zbStyle']['property']['width']>0){
    imagew = style['zbStyle']['property']['width'];
  }else if(iconSize != null){
    imagew = iconSize['w'];
  }
  double imageh = 0;
  if(style['zbStyle']['property']['height'] != null && style['zbStyle']['property']['height']>0){
    imageh = style['zbStyle']['property']['height'];
  }else if(iconSize != null){
    imageh = iconSize['h'];
  }
  Map size = {
    'x': x,
    'y': y-imageh/2,
    'w': imagew,
    'h': imageh,
  };
  return {
    'iconPath':[
      "drawIcon",
      [
        id,
        icon,
        size['x'],
        size['y'],
        size['w'],
        size['h'],
        false,
        null,
      ]
    ],
    'size':size
  };
}