chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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'
}