Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let move x' y' (shape, _, _, height, width) =
- (shape, x', y', height, width)
- type Event =
- | ShapeCreated of shape:string * x:int * y:int * id:int64
- | ShapeMoved of x: int * y: int * id: int64
- | ShapeDeleted of id: int64
- let folder state event =
- match event with
- | ShapeCreated(shape, x, y, id) ->
- Map.add id (shape ,x, y, 50, 50) state
- | ShapeMoved(x', y', id) ->
- Map.map (fun key shape ->
- if key = id then move x' y' shape
- else shape)
- state
- | ShapeDeleted id ->
- Map.remove id state
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement