Skip to content
Snippets Groups Projects
Commit a4bf2c10 authored by Sabed Ger's avatar Sabed Ger
Browse files

StateManager commiit

parent 080a0e7f
No related branches found
No related tags found
1 merge request!1Develop
module Manager.StateManager exposing (..)
-- Own
import Manager.ModalManager exposing (Modal(..), eq_String_Modal, modalNameToString, getInputShapeFromModal)
import Util.ShapeManager exposing (Shape(..))
import Util.Util exposing (MousePosition)
type State
= Standby
| ActiveModal Modal
| DrawShape Shape MousePosition
-- Operations on State
eq_String_State : String -> State -> Bool
eq_String_State string state = string==(stateNameToString state)
manageState : State -> State
manageState state = if ( (eq_String_State "ActiveModal" state)
&&(eq_String_Modal "NoModal" (getModalFromState state))
)
then Standby
else state
-- Transform State to other Types
stateNameToString : State -> String
stateNameToString state =
case state of
Standby -> "Standby"
ActiveModal modal -> "ActiveModal"
DrawShape _ _ -> "DrawShape"
-- Get Methods : Parameter of State
getInputShapeFromState : State -> Shape
getInputShapeFromState state =
case state of
Standby -> Empty
ActiveModal modal -> getInputShapeFromModal modal
DrawShape shape _ -> shape
getModalFromState : State -> Modal
getModalFromState state =
case state of
Standby -> NoModal
ActiveModal modal -> modal
DrawShape _ _ -> NoModal
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment