Skip to content

ImageItem.drawAt() method ignores "axisOrder" config option #784

@honkomonk

Description

@honkomonk

Symptom:
If you use the "draw feature" of a ImageItem while the axisOrder is set to "row-major" the image will be transposed, but the coordiates of the mouse pointer are not.

Example:
Take the default "GraphicsItems/ImageItem - draw" example under pyqtgraph/examples/draw.py and add the line pg.setConfigOptions(imageAxisOrder='row-major') after the imports. Drawing and mouse pointer are now out of sync.

Suggested fix:
In the method ´drawAt()´ replace the line:
pos = [int(pos.x()), int(pos.y())]
with
pos = [int(pos.y()), int(pos.x())] if self.axisOrder == 'row-major' else [int(pos.x()), int(pos.y())]

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