import class gameuiHudSafezonesEditorGameController extends gameuiMenuGameController
{
	public import function AdjustMargin( adjustment : Vector2 );
	public import function SaveSettings();

	private var m_data : weak< inkGameNotificationData >;
	private const var c_adjustment_speed : Float;
	default c_adjustment_speed = 400.0f;
	private const var c_stick_dead_zone : Float;
	default c_stick_dead_zone = 0.f;

	protected event OnInitialize()
	{
		m_data = ( ( inkGameNotificationData )( GetRootWidget().GetUserData( 'inkGameNotificationData' ) ) );
		RegisterToGlobalInputCallback( 'OnPostOnRelease', this, 'OnRelease' );
		RegisterToGlobalInputCallback( 'OnPostOnAxis', this, 'OnAxisInput' );
	}

	protected event OnUninitialize()
	{
		UnregisterFromGlobalInputCallback( 'OnPostOnRelease', this, 'OnRelease' );
		UnregisterFromGlobalInputCallback( 'OnPostOnAxis', this, 'OnAxisInput' );
	}

	protected event OnRelease( evt : inkPointerEvent )
	{
		if( evt.IsAction( 'close_popup' ) || evt.IsAction( 'proceed' ) )
		{
			if( evt.IsAction( 'proceed' ) )
			{
				SaveSettings();
			}
			m_data.token.TriggerCallback( m_data );
		}
	}

	protected event OnAxisInput( evt : inkPointerEvent )
	{
		var amount : Float;
		amount = evt.GetAxisData();
		if( AbsF( amount ) < c_stick_dead_zone )
		{
			return 0;
		}
		if( evt.IsAction( 'LeftX_Axis' ) || evt.IsAction( 'DigitX_Axis' ) )
		{
			AdjustMargin( Vector2( ( amount * c_adjustment_speed ) * -1.0, 0.0 ) );
		}
	}

}

