コード例 #1
0
 public static HistoricalCourseEditorState UpdateProp(this HistoricalCourseEditorState state, EditorProp prop)
 {
     if (state.Props.ContainsKey(prop.Id))
     {
         return(state.Update(state.SelectedProp, state.Props.SetItem(prop.Id, prop), state.PropOrder));
     }
     else
     {
         return(state);
     }
 }
コード例 #2
0
        public static HistoricalCourseEditorState AddProp(this HistoricalCourseEditorState state, ImmutableTransform transform)
        {
            var propId  = PropId.CreateRandomId();
            var newProp = new EditorProp {
                Id = propId, PropType = state.SelectedPropType, Transform = transform
            };
            // Immediately select the newly created prop
            var selectedProp = Maybe.Just(propId);

            return(state.Update(selectedProp, state.Props.Add(newProp.Id, newProp), state.PropOrder.Add(propId)));
        }
コード例 #3
0
 public static HistoricalCourseEditorState UpdatePropOrder(this HistoricalCourseEditorState state, IImmutableList <PropId> newPropOrder)
 {
     return(state.Update(state.SelectedProp, state.Props, newPropOrder));
 }
コード例 #4
0
 public static HistoricalCourseEditorState SelectProp(this HistoricalCourseEditorState state, Maybe <PropId> selectedPropId)
 {
     return(state.Update(selectedPropId, state.Props, state.PropOrder));
 }
コード例 #5
0
        public static HistoricalCourseEditorState DeleteProp(this HistoricalCourseEditorState state, PropId id)
        {
            var selectedProp = state.SelectedProp.Equals(Maybe.Just(id)) ? Maybe.Nothing <PropId>() : state.SelectedProp;

            return(state.Update(selectedProp, state.Props.Remove(id), state.PropOrder.Remove(id)));
        }