Quintiq file version 2.0
#parent: CustomDrawComponentContainer/Minimap
Response OnClick () id:Response_CustomDrawComponentContainer_Minimap_OnClick
{
  #keys: '[139164.4.339800987]'
  Body:
  [*
    if( not isnull( DataHolderRun.Data() ) )
    {
      x := action.X() - this.LegendLeft();
      y := action.Y() - this.LegendTop();
    
      max_x := max( DataHolderRun.Data(), Component.UIGraphNode, node, node.X() + node.Width() / 2 );
      max_y := max( DataHolderRun.Data(), Component.UIGraphNode, node, node.Y() + node.Height() / 2 );
      
      offset := 5;
      width := this.LegendWidth() - offset * 2;
      height := this.LegendHeight() - offset * 2;
      
      scale := minvalue( width / max_x, height / max_y );
      
      offset_x := ( width - max_x * scale ) / 2 + offset;
      offset_y := ( height - max_y * scale ) / 2 + offset;
      
      rel_x := ( x - offset_x ) / scale;
      rel_y := ( y - offset_y ) / scale;
    
      Form.CustomDrawComponentContainer().EnsureVisible( [Number] rel_x, [Number] rel_y, 'center', 'center' );
    }
  *]
  CanBindMultiple: false
  DefinitionID: 'Responsedef_CustomDrawBaseLayer_OnClick'
}
