Skip to content

Insufficient precision of the get_plot_mouse_pos() #1847

@sedenka

Description

@sedenka

Version of Dear PyGui

Version: 1.6.2
Operating System: Windows 10

My Issue/Question

Function dpg.get_plot_mouse_pos() does not return coordinates with sufficient precision. The mouse position is stored in the mvContext as float. Such precision is insufficient for time axis storing timestamps. The precision should be fixed also here and here.

To Reproduce

Steps to reproduce the behavior:

  1. Run the code below.
  2. Move the mouse pointer horizontally over the graph area.
  3. Watch the coordinates in the command line output (the x-coordinate is not changing, it is always 1658792448.0)

Expected behavior

The first ("x") coordinate should change between 1658792466.0 and 1658792466.999 according to mouse move.

Standalone, minimal, complete and verifiable example

import dearpygui.dearpygui as dpg

dpg.create_context()
dpg.create_viewport()
dpg.setup_dearpygui()

def mouse_move_callback():
    print(dpg.get_plot_mouse_pos())

with dpg.handler_registry():
    dpg.add_mouse_move_handler(callback=mouse_move_callback)

with dpg.window(tag="Primary"):
    with dpg.plot(height=-1, width=-1):
        dpg.add_plot_axis(dpg.mvXAxis, time=True)
        with dpg.plot_axis(dpg.mvYAxis):
            dpg.add_scatter_series([1658792466, 1658792467], [0, 1])

dpg.show_viewport()
dpg.set_primary_window("Primary", True)
dpg.start_dearpygui()
dpg.destroy_context()

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: improvementimprovements or optimizations are needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions