rigImGui 0.1.1
RigKit pack API - rigImGui
Loading...
Searching...
No Matches
Rulers.h File Reference
#include <imgui.h>
Include dependency graph for Rulers.h:
This graph shows which files directly or indirectly include this file:

Enumerations

enum class  rigkit::RulerUnit
 Display unit for host / Viewport rulers (persisted as UiPrefs.rulerUnit).

Functions

float rigkit::rulerPixPerDisplayUnit (RulerUnit unit, float contentZoomAbs, float dpiScale)
 Screen pixels per display unit for content that is measured in pixels.
float rigkit::rulerPixPerWorldCm (RulerUnit unit, float pixelsPerWorldCm, float dpiScale)
 Screen pixels per display unit when 1 world unit is 1 cm (CAD / 3D).
float rigkit::rulerPixPerContentUnit (RulerUnit display, float zoomAbs, const char *contentUnit, float dpiScale=1.f)
 Screen pixels per display unit when content is page / world units.
bool rigkit::rulerHitStrip (ImVec2 origin, ImVec2 size, ImVec2 mouse, float uiScale=1.f)
 True if mouse is over the top or left ruler strip (corner counts as both).
void rigkit::drawRulersInRegion (ImDrawList *dl, ImVec2 origin, ImVec2 size, ImVec2 mouse, float pixPerUnit, const char *unitLabel, float uiScale=1.f, ImVec2 contentOrigin=ImVec2(0, 0), bool flipY=false)
 Draw top/left ruler strips over a screen region.
bool rigkit::rulerUnitPopup (const char *popupId, int &rulerUnit)
 Right-click unit picker popup (call every frame; OpenPopup when strip hit).

Function Documentation

◆ drawRulersInRegion()

void rigkit::drawRulersInRegion ( ImDrawList * dl,
ImVec2 origin,
ImVec2 size,
ImVec2 mouse,
float pixPerUnit,
const char * unitLabel,
float uiScale = 1.f,
ImVec2 contentOrigin = ImVec2(0, 0),
bool flipY = false )

Draw top/left ruler strips over a screen region.

Parameters
pixPerUnitScreen pixels per display unit.
contentOriginScreen position of content (0,0) so ticks track pan/zoom.
flipYLabel the vertical strip y-up (font units, CAD) instead of screen-down.

◆ rulerPixPerContentUnit()

float rigkit::rulerPixPerContentUnit ( RulerUnit display,
float zoomAbs,
const char * contentUnit,
float dpiScale = 1.f )

Screen pixels per display unit when content is page / world units.

Parameters
zoomAbsView2D::zoomAbs (screen pixels per content unit).
contentUnit"in", "mm", "cm", or "px".

◆ rulerPixPerDisplayUnit()

float rigkit::rulerPixPerDisplayUnit ( RulerUnit unit,
float contentZoomAbs,
float dpiScale )

Screen pixels per display unit for content that is measured in pixels.

Parameters
contentZoomAbsView2D::zoomAbs (1 = identity screen mapping).
dpiScaleWindow content scale (HiDPI); used with 96 CSS PPI.

◆ rulerPixPerWorldCm()

float rigkit::rulerPixPerWorldCm ( RulerUnit unit,
float pixelsPerWorldCm,
float dpiScale )

Screen pixels per display unit when 1 world unit is 1 cm (CAD / 3D).

Parameters
pixelsPerWorldCmHow many view pixels a 1 cm world offset covers at the focus.

Px falls back to identity screen pixels. pixelsPerWorldCm <= 0 uses the paper mapping (rulerPixPerDisplayUnit at zoom 1).

◆ rulerUnitPopup()

bool rigkit::rulerUnitPopup ( const char * popupId,
int & rulerUnit )

Right-click unit picker popup (call every frame; OpenPopup when strip hit).

Returns
true if the unit value changed.