Quintiq file version 2.0
#parent: CustomDrawSCO/CustomDrawDataLayerGrid
Response OnDrawObject (
  SupplyChainView object
) id:Response_CustomDrawSCO_CustomDrawDataLayerGrid_OnDrawObject
{
  #keys: '[136682.0.1912949910]'
  CanBindMultiple: false
  DefinitionID: 'Responsedef_WebCustomDrawDataLayer_OnDrawObject'
  QuillAction
  {
    Body:
    [*
      // Draw background image
      
      // Draw the background image defined in global parameter unless it's in a drilled down unit
      view := object;
      bgimage := guard( view.SupplyChainBackground(), '' );
      
      focusedunitnode := select( object, Node.astype( UnitNode ), n, n.Unit() = DataHolderFocusedUnit.Data() );
      
      if ( not isnull( focusedunitnode ) )
      {
        bgimage := focusedunitnode.BackgroundImageName();
      }
      
      if ( bgimage <> '' )
      {
        surface.Image( region.BoundingRect().Left() , region.BoundingRect().Top(), bgimage );
      }
      
      if( object.IsGridVisible() )
      {
        surface.Pen().Color( ColorScheme.SupplyChainOverview_Grid() ); 
        surface.Pen().Style( PenSpecification::StyleSolid() );
        surface.Pen().Width( 1 );
        
        width := object.GridWidth();
        height := object.GridHeight();
        grid := object.GridPointDistance();
      
        for ( x := 0; x < width; x := x + grid )
        {
          surface.Line( x, 0, x, height );
        }
      
        for ( y := 0; y < height; y := y + grid )
        {
          surface.Line( 0, y, width, y );
        }
      }
    *]
    GroupServerCalls: false
  }
}
