Closed BWheatie closed 4 years ago
** (Scenic.Primitive.Style.FormatError) Elixir.Scenic.Primitive.Style.Stroke data must be {width, paint_type} Received: nil This is very similar to the :fill style. with an added width examples: {12, :red} {12, {:color, :red}} (scenic 0.10.2) lib/scenic/primitive/style/stroke.ex:26: Scenic.Primitive.Style.Stroke.verify!/1 (scenic 0.10.2) lib/scenic/primitive.ex:260: anonymous fn/2 in Scenic.Primitive.apply_style_options/2 (elixir 1.10.3) lib/enum.ex:2111: Enum."-reduce/3-lists^foldl/2-0-"/3 (scenic 0.10.2) lib/scenic/primitive.ex:249: Scenic.Primitive.apply_style_options/2 (scenic 0.10.2) lib/scenic/primitive.ex:232: Scenic.Primitive.apply_options/2 (scenic 0.10.2) lib/scenic/graph.ex:248: Scenic.Graph.add/4 (scenic 0.10.2) lib/scenic/graph.ex:242: Scenic.Graph.add/4 (draw_o_matic 0.1.0) lib/scenes/home.ex:107: DrawOMatic.Scene.Home.do_handle_input/3 Last message: {:"$gen_cast", {:input, {:cursor_button, {:left, :press, 0, {1326.76171875, 621.40625}}}, %Scenic.ViewPort.Context{graph_key: {:graph, #Reference<0.88115342.3468689415.251780>, nil}, id: nil, inverse_tx: <<0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...>>, raw_input: {:cursor_button, {:left, :press, 0, {1326.76171875, 621.40625}}}, tx: <<0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...>>, uid: 1, viewport: #PID<0.212.0>}}} State: %{activation: :__not_activated__, children: %{}, dyn_scene_keys: %{2 => {:graph, #Reference<0.88115342.3468689409.259843>, nil}}, dyn_scene_pids: %{2 => #PID<0.1445.0>}, dynamic_children_pid: #PID<0.1443.0>, has_children: true, parent_pid: nil, raw_scene_refs: %{2 => {Scenic.Component.Button, "Clear"}}, scene_module: DrawOMatic.Scene.Home, scene_ref: #Reference<0.88115342.3468689415.251780>, scene_state: %DrawOMatic.Scene.Home.State{drawing: false, erasing: nil, graph: %Scenic.Graph{add_to: 0, animations: [], ids: %{_root_: [0], clear_graph: [2]}, next_uid: 115, primitives: %{0 => %{__struct__: Scenic.Primitive, data: [1, 2], module: Scenic.Primitive.Group, parent_uid: -1, styles: %{clear_color: :white, font: :roboto, font_size: 24}}, 1 => %{__struct__: Scenic.Primitive, data: {1400, 1000}, module: Scenic.Primitive.Rectangle, parent_uid: 0}, 2 => %Scenic.Primitive{data: {Scenic.Component.Button, "Clear"}, id: :clear_graph, module: Scenic.Primitive.SceneRef, parent_uid: 0, styles: %{t: {600, 0}}, transforms: %{translate: {600, 0}}}}}, prev_coords: nil, saved: nil, stroke: nil, super: nil, timer: nil, viewport: nil}, supervisor_pid: #PID<0.219.0>, viewport: #PID<0.212.0>} {%Scenic.Primitive.Style.FormatError{ data: nil, message: " \e[31mElixir.Scenic.Primitive.Style.Stroke data must be {width, paint_type}\n \e[33mReceived: nil\n\n This is very similar to the :fill style. with an added width\n examples:\n {12, :red}\n {12, {:color, :red}}\n\n \e[39m\n", module: Scenic.Primitive.Style.Stroke }, [ {Scenic.Primitive.Style.Stroke, :verify!, 1, [file: 'lib/scenic/primitive/style/stroke.ex', line: 26]}, {Scenic.Primitive, :"-apply_style_options/2-fun-0-", 2, [file: 'lib/scenic/primitive.ex', line: 260]}, {Enum, :"-reduce/3-lists^foldl/2-0-", 3, [file: 'lib/enum.ex', line: 2111]}, {Scenic.Primitive, :apply_style_options, 2, [file: 'lib/scenic/primitive.ex', line: 249]}, {Scenic.Primitive, :apply_options, 2, [file: 'lib/scenic/primitive.ex', line: 232]}, {Scenic.Graph, :add, 4, [file: 'lib/scenic/graph.ex', line: 248]}, {Scenic.Graph, :add, 4, [file: 'lib/scenic/graph.ex', line: 242]}, {DrawOMatic.Scene.Home, :do_handle_input, 3, [file: 'lib/scenes/home.ex', line: 107]} ]}```
Fixed in master. Clearing was not using old state with new state just a new state so it was clearing everything out.