Custom Curve Editor shift click Action

24 views
Skip to first unread message

vorp

unread,
Jun 10, 2015, 1:48:00 PM6/10/15
to authoring-to...@googlegroups.com
I'm trying to figure out the best way to make some custom behavior fire when the user shift-clicks on a curve in the CurveEditingControl.
This is because I want to affect other curves, not just the one the user clicks on (since some of them are interrelated).
The shift-click behavior seems buried inside CurveCanvas.
Do I need to create my own copy of CurveCanvas and CurveEditingControl or is there an easier way?

Thanks.

-Len

Ron2

unread,
Jun 15, 2015, 9:16:13 PM6/15/15
to authoring-to...@googlegroups.com, l...@lenwhite.com
Hi Len,

Sorry I forgot to respond to this last week.

I just briefly looked over those two classes. Is it possible to accomplish your goal by overriding the protected virtual method CurveCanvas.OnMouseDown()? Or do you need to modify the logic that we have in there?

If you can simply derive from CurveCanvas, then it looks like you can pass in your derived class object to the CurveEditingControl constructor. Then you'll have to use the constructor of CurveEditor that takes a CurveEditingControl. To make use of your own CurveEditor object, you have to remove the "typeof(CurveEditor)" from the MEF TypeCatalog and add in the object directly instead, like this:

var catalog = new TypeCatalog(
...
//typeof(CurveEditor),
...
);

// Set up the MEF container with these components
var container = new CompositionContainer(catalog);
var batch = new CompositionBatch();
var curveCanvas = new CustomCurveCanvas(); //customizes the mouse-down behavior
var curveEditingControl = new CurveEditingControl(curveCanvas);
batch.AddPart(new CurveEditor(curveEditingControl));
container.Compose(batch);

I didn't check that this compiles, but hopefully it's close enough. :-)

If you need to modify the logic inside CurveCanvas.OnMouseDown(), you could try submitting a pull request or emailing me the diff file that introduces a customization point somehow.

--Ron

vorp

unread,
Jun 23, 2015, 9:02:29 PM6/23/15
to authoring-to...@googlegroups.com, rona...@gmail.com, l...@lenwhite.com
Thanks! Let me look at that a little closer and see if that will do it.
Reply all
Reply to author
Forward
0 new messages