Skip to content

IDraggable: Add multi-axis support #1545

@BambOoxX

Description

@BambOoxX

Features Suggestion

Feature description:

The mouse interaction for dragable plottables should take the axis index into account. Currently it seems to call

        /// <summary>
        /// Return the X position (in coordinate space) for the given pixel column
        /// </summary>
        /// <param name="xPixel">horizontal pixel location</param>
        /// <returns>horizontal position in coordinate space</returns>
        public double GetCoordinateX(float xPixel) => settings.XAxis.Dims.GetUnit(xPixel);

        /// <summary>
        /// Return the Y position (in coordinate space) for the given pixel row
        /// </summary>
        /// <param name="yPixel">vertical pixel location</param>
        /// <returns>vertical position in coordinate space</returns>
        public double GetCoordinateY(float yPixe) => settings.XAxis.Dims.GetUnit(yPixel);

Which only works if everything happens on the first axis (X and/or Y). If the plottable is on another set of axes, the IsUnderMouse and DragTo methods fail because the coordinates are wrong.

A short term patch could be to consider the second axes too with e.g.

        /// <summary>
        /// Return the X position (in coordinate space) for the given pixel column
        /// </summary>
        /// <param name="xPixel">horizontal pixel location</param>
        /// <returns>horizontal position in coordinate space</returns>
        public double GetCoordinateX(float xPixel,int axisindex = 0) => axisindex == 0 ? settings.XAxis.Dims.GetUnit(xPixel) : settings.XAxis2.Dims.GetUnit(xPixel);

        /// <summary>
        /// Return the Y position (in coordinate space) for the given pixel row
        /// </summary>
        /// <param name="yPixel">vertical pixel location</param>
        /// <returns>vertical position in coordinate space</returns>
        public double GetCoordinateY(float yPixel,int axisindex = 0) => axisindex == 0 ? settings.XAxis.Dims.GetUnit(yPixel) : settings.YAxis2.Dims.GetUnit(yPixel);

If one adds other axes I am not sure how to retrieve the current one...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions