diff options
Diffstat (limited to 'lib/wx/examples/demo/ex_canvas.erl')
-rw-r--r-- | lib/wx/examples/demo/ex_canvas.erl | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/wx/examples/demo/ex_canvas.erl b/lib/wx/examples/demo/ex_canvas.erl index 2a95ea0777..b00ce81993 100644 --- a/lib/wx/examples/demo/ex_canvas.erl +++ b/lib/wx/examples/demo/ex_canvas.erl @@ -136,11 +136,14 @@ handle_event(#wx{event = #wxCommand{type = command_button_clicked}}, {noreply, State}; handle_event(#wx{event = #wxSize{size={W,H}}}, State = #state{bitmap=Prev, canvas=Canvas}) -> - Bitmap = wxBitmap:new(W,H), - draw(Canvas, Bitmap, fun(DC) -> wxDC:clear(DC) end), - wxBitmap:destroy(Prev), - {noreply, State#state{bitmap = Bitmap}}; - + if W > 0 andalso H > 0 -> + Bitmap = wxBitmap:new(W,H), + draw(Canvas, Bitmap, fun(DC) -> wxDC:clear(DC) end), + wxBitmap:destroy(Prev), + {noreply, State#state{bitmap = Bitmap}}; + true -> + {noreply, State} + end; handle_event(#wx{event = #wxMouse{type=left_down, x=X, y=Y}}, State) -> {noreply, State#state{pos={X,Y}}}; handle_event(#wx{event = #wxMouse{type=motion, x=X1, y=Y1}}, |