X Tutup
Skip to content

Handle mouse events on PlotController instead of PlotModel (and elements) #111

@objorke

Description

@objorke

Imported from http://oxyplot.codeplex.com/workitem/10132

objo 2014-02-17 08:08
We can achieve the same functionality by using a PlotController

https://oxyplot.codeplex.com/workitem/9625

  • Better separation of controller logic and model
  • Less code
  • Better performance of PlotController

objo 2014-03-19 22:57
It seems to be quite convenient to use the events. Or is that valid only for the simple demos?

objo 2014-03-21 09:02
An alternative could be to add an EnableMouseEventsInModel property on the
PlotController. The default value could be false. When the value is false, the mouse events should not be raised on the
PlotModel and PlotElements.

tibel 2014-04-12 08:43
Hmm, still don't like it. The PlotModel and its child elements should not know anything about a mouse, keyboard or touch. Also it is easy to create memory leaks by events on child elements of the PlotModel when your plot is more dynamic (e.g. adding and
removing annotations).

Therefore I would prefer following:

  • mouse/keyboard events exist only on PlotController and the event will tell you what element of the plot was e.g. clicked
  • similar the AxisChanged should be on PlotModel and tell you what axis changed
  • Ultimately no child element of the plotmodel should expose any events

With this approach I don't have problems with adding/removing elements from the plotmodel and my event handlers.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup