DIWNE::Canvas
Representation of the 2D infinite plane of a node editor. More...
#include "DIWNE/Core/Canvas.h"
Public Functions
Name | |
---|---|
Canvas(NodeEditor & editor) | |
void | AddBezierCurveDiwne(ImDrawList * idl, const ImVec2 & p1, const ImVec2 & p2, const ImVec2 & p3, const ImVec2 & p4, ImVec4 col, float thickness, int num_segments =0) const<br>Draw Bezier (not Bezier really) curve to window ImDrawList. |
void | AddLine(const ImVec2 & p1, const ImVec2 & p2, const ImVec4 & col, float thickness =1.0f, bool ignoreZoom =false) const |
void | AddRectDiwne(const ImVec2 & p_min, const ImVec2 & p_max, const ImVec4 & col, float rounding =0.0f, ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll, float thickness =1.0f, bool ignoreZoom =false) const<br>Draw rectangle to window ImDrawlist This method accepts DIWNE coordinates and converts them to truncated screen coordinates. |
void | AddRectFilledDiwne(const ImVec2 & p_min, const ImVec2 & p_max, const ImVec4 & col, float rounding =0.0f, ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll, bool ignoreZoom =false) const<br>Draw filled rectangle to window ImDrawlist This method accepts DIWNE coordinates and converts them to truncated screen coordinates. |
void | AddRectForegroundDiwne(const ImVec2 & p_min, const ImVec2 & p_max, const ImVec4 & col, float rounding =0.0f, ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll, float thickness =1.0f, bool ignoreZoom =false) const |
bool | applyZoomScaling()<br>Modifies the current ImGuiStyle and Font depending on the current diwne zoom level. |
float | applyZoomScalingToFont(ImFont * font, float scaleMultiplier)<br>Modifies the current Font depending on the current diwne zoom level. |
ImRect | diwne2screen(const ImRect & rect) const<br>Convert diwne rect to a screen rect. |
ImVec2 | diwne2screen(const ImVec2 & point) const |
ImVec2 | diwne2screenSize(const ImVec2 & point) const<br>Apply diwne scaling factors to an ImVec2 size. |
float | diwne2screenSize(float size) const<br>Apply diwne scaling factors to a float size. |
float | diwne2screenSizeTrunc(float size) const |
ImRect | diwne2screenTrunc(const ImRect & rect) const<br>Convert diwne rect to pixel aligned screen rect. |
ImVec2 | diwne2screenTrunc(const ImVec2 & point) const<br>Convert diwne point to pixel aligned screen position. |
ImVec2 | diwne2workArea(const ImVec2 & point) const |
void | DrawBurgerMenu(ImDrawList * idl, const ImColor & color, const ImRect & rect, const ImVec2 & padding, float thickness) const |
void | drawGrid(bool dots, float size, ImVec4 color, float fadeStart, float fadeEnd, bool ignoreZoom) const |
void | DrawIcon(IconType bgIconType, ImColor bgShapeColor, ImColor bgInnerColor, IconType fgIconType, ImColor fgShapeColor, ImColor fgInnerColor, ImVec2 size, ImVec4 padding, bool filled, ImVec2 thickness =ImVec2(1, 1), float rounding =0) const<br>Draw an Icon combined from two parts (foreground and background) to the window ImDrawList filled with a ShapeColor. |
void | DrawIconCircle(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const<br>Draw a circle icon. |
void | DrawIconCross(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float shapeThickness =2, float innerThickness =1) const |
void | DrawIconFastForward(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const |
void | DrawIconGrabDownLeft(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const |
void | DrawIconGrabDownRight(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const |
void | DrawIconHyphen(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =3.0f) const |
void | DrawIconPause(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, ImVec2 thickness =ImVec2(1, 1), float rounding =0) const |
void | DrawIconRectangle(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, ImVec2 thickness =ImVec2(1, 1), float rounding =0) const |
void | DrawIconRewind(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const |
void | DrawIconSkipBack(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const |
void | DrawIconSkipBack2(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const |
void | DrawIconSkipForward(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const |
void | DrawIconSkipForward2(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const |
void | DrawIconTriangleDownLeft(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const |
void | DrawIconTriangleDownRight(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const |
void | DrawIconTriangleLeft(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const |
void | DrawIconTriangleRight(ImDrawList * idl, ImColor shapeColor, ImColor innerColor, ImVec2 topLeft, ImVec2 bottomRight, bool filled, float thickness =1) const |
void | EmptyButton(ImVec2 size, ImColor color, float rounding)<br>Just the shape of the button, no interaction. |
bool | ensureZoomScaling(bool active)<br>Ensure that zoom scaling is active or not based on a passed parameter. |
ImRect | getViewportRectDiwne() const |
ImRect | getViewportRectScreen() const |
float | getZoom() const |
bool | IconButton(IconType bgIconType, ImColor bgShapeColor, ImColor bgInnerColor, ImVec2 size, ImVec4 padding, bool filled, std::string id) const<br>Add ImGui Button with icon on it. |
bool | IconButton(std::string id, bool disabled, IconType bgIconType, ImColor bgShapeColor, ImColor bgInnerColor, IconType fgIconType, ImColor fgShapeColor, ImColor fgInnerColor, ImVec2 size, ImVec4 padding, bool filled, ImVec2 thickness =ImVec2(1, 1), float rounding =0) const<br>Add ImGui Button with icon on it. |
bool | IconButton2(const std::string & id, ImVec2 size, bool disabled, IconType bgIconType, IconType fgIconType, const IconStyle & style, const IconStyle & hoveredStyle, const IconStyle & activeStyle) const<br>// TODO: (DR) Docs, new IconButton that allows various styles depening on the button state (hover, maybe press) Add ImGui Button with icon on it |
void | moveViewport(const ImVec2 & distance) |
void | moveViewportZoomed(const ImVec2 & distance) |
ImRect | screen2diwne(const ImRect & rect) const<br>Convert screen rect to a diwne rect. |
ImVec2 | screen2diwne(const ImVec2 & point) const |
ImVec2 | screen2diwneSize(const ImVec2 & point) const<br>Revert diwne scaling factors from a ImVec2 size. |
float | screen2diwneSize(float size) const<br>Revert diwne scaling factors from a float size. |
ImVec2 | screen2workArea(const ImVec2 & point) const |
void | setViewportRectDiwne(ImRect rect) |
virtual void | setZoom(float val) |
bool | stopZoomScaling()<br>Restores the current ImGuiStyle and Font back to its state before applyZoomScaling() was last called. |
void | stopZoomScalingToFont(ImFont * font, float originalScale) |
void | updateViewportRects()<br>Update screen and diwne positions and sizes of viewport. |
ImVec2 | workArea2diwne(const ImVec2 & point) const |
ImVec2 | workArea2screen(const ImVec2 & point) const |
Protected Functions
Name | |
---|---|
void | ScaleAllSizes(ImGuiStyle & style, float scale_factor) |
Public Attributes
Name | |
---|---|
float | m_prevZoom <br>Last frame zoom factor. |
float | m_unscaledFontSize <br>Original font size. |
ImRect | m_viewRectDiwne <br>Bounds of the canvas viewport in canvas/editor's coordinates (diwne coordinates). |
ImRect | m_viewRectScreen <br>Viewport bounds in screen space coordinates. |
float | m_zoom <br>Viewport zoom factor (scale ratio between diwne and screen coordinates). |
bool | m_zoomScalingApplied <br>Whether zoom UI scaling has been applied or not to Dear ImGui. |
Protected Attributes
Name | |
---|---|
NodeEditor & | editor |
float | m_zoomOriginalFontScale <br>Original font scale. |
ImGuiStyle | m_zoomOriginalStyle <br>Original ImGui style. |
Detailed Description
class DIWNE::Canvas;
class DIWNE::Canvas;
Representation of the 2D infinite plane of a node editor.
// TODO: Coordinate systems docs (screen space, viewport coordinates, canvas/editor/diwne coordinates
Public Functions Documentation
function Canvas
Canvas(
NodeEditor & editor
)
Canvas(
NodeEditor & editor
)
function AddBezierCurveDiwne
void AddBezierCurveDiwne(
ImDrawList * idl,
const ImVec2 & p1,
const ImVec2 & p2,
const ImVec2 & p3,
const ImVec2 & p4,
ImVec4 col,
float thickness,
int num_segments =0
) const
void AddBezierCurveDiwne(
ImDrawList * idl,
const ImVec2 & p1,
const ImVec2 & p2,
const ImVec2 & p3,
const ImVec2 & p4,
ImVec4 col,
float thickness,
int num_segments =0
) const
Draw Bezier (not Bezier really) curve to window ImDrawList.
Parameters:
- p1 const ImVec2& start point in diwne coords
- p2 const ImVec2& start control point in diwne coords
- p3 const ImVec2& end control point in diwne coords
- p4 const ImVec2& end point in diwne coords
- col ImVec4
- thickness float
- 0 int num_segments with zero ImGui use some optimal? value
Return: void
function AddLine
void AddLine(
const ImVec2 & p1,
const ImVec2 & p2,
const ImVec4 & col,
float thickness =1.0f,
bool ignoreZoom =false
) const
void AddLine(
const ImVec2 & p1,
const ImVec2 & p2,
const ImVec4 & col,
float thickness =1.0f,
bool ignoreZoom =false
) const
function AddRectDiwne
void AddRectDiwne(
const ImVec2 & p_min,
const ImVec2 & p_max,
const ImVec4 & col,
float rounding =0.0f,
ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll,
float thickness =1.0f,
bool ignoreZoom =false
) const
void AddRectDiwne(
const ImVec2 & p_min,
const ImVec2 & p_max,
const ImVec4 & col,
float rounding =0.0f,
ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll,
float thickness =1.0f,
bool ignoreZoom =false
) const
Draw rectangle to window ImDrawlist This method accepts DIWNE coordinates and converts them to truncated screen coordinates.
See: AddRectFilledDiwne
function AddRectFilledDiwne
void AddRectFilledDiwne(
const ImVec2 & p_min,
const ImVec2 & p_max,
const ImVec4 & col,
float rounding =0.0f,
ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll,
bool ignoreZoom =false
) const
void AddRectFilledDiwne(
const ImVec2 & p_min,
const ImVec2 & p_max,
const ImVec4 & col,
float rounding =0.0f,
ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll,
bool ignoreZoom =false
) const
Draw filled rectangle to window ImDrawlist This method accepts DIWNE coordinates and converts them to truncated screen coordinates.
Parameters:
- p_min bottom left corner in diwne coords
- p_max top right corner in diwne coords
- col
- rounding
- rounding_corners
function AddRectForegroundDiwne
void AddRectForegroundDiwne(
const ImVec2 & p_min,
const ImVec2 & p_max,
const ImVec4 & col,
float rounding =0.0f,
ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll,
float thickness =1.0f,
bool ignoreZoom =false
) const
void AddRectForegroundDiwne(
const ImVec2 & p_min,
const ImVec2 & p_max,
const ImVec4 & col,
float rounding =0.0f,
ImDrawFlags rounding_corners =ImDrawFlags_RoundCornersAll,
float thickness =1.0f,
bool ignoreZoom =false
) const
function applyZoomScaling
bool applyZoomScaling()
bool applyZoomScaling()
Modifies the current ImGuiStyle and Font depending on the current diwne zoom level.
Return: Whether zoom scaling was active before making this call
function applyZoomScalingToFont
float applyZoomScalingToFont(
ImFont * font,
float scaleMultiplier
)
float applyZoomScalingToFont(
ImFont * font,
float scaleMultiplier
)
Modifies the current Font depending on the current diwne zoom level.
Return: Whether zoom scaling was active before making this call
function diwne2screen
ImRect diwne2screen(
const ImRect & rect
) const
ImRect diwne2screen(
const ImRect & rect
) const
Convert diwne rect to a screen rect.
function diwne2screen
ImVec2 diwne2screen(
const ImVec2 & point
) const
ImVec2 diwne2screen(
const ImVec2 & point
) const
function diwne2screenSize
ImVec2 diwne2screenSize(
const ImVec2 & point
) const
ImVec2 diwne2screenSize(
const ImVec2 & point
) const
Apply diwne scaling factors to an ImVec2 size.
function diwne2screenSize
float diwne2screenSize(
float size
) const
float diwne2screenSize(
float size
) const
Apply diwne scaling factors to a float size.
function diwne2screenSizeTrunc
float diwne2screenSizeTrunc(
float size
) const
float diwne2screenSizeTrunc(
float size
) const
function diwne2screenTrunc
ImRect diwne2screenTrunc(
const ImRect & rect
) const
ImRect diwne2screenTrunc(
const ImRect & rect
) const
Convert diwne rect to pixel aligned screen rect.
function diwne2screenTrunc
ImVec2 diwne2screenTrunc(
const ImVec2 & point
) const
ImVec2 diwne2screenTrunc(
const ImVec2 & point
) const
Convert diwne point to pixel aligned screen position.
function diwne2workArea
ImVec2 diwne2workArea(
const ImVec2 & point
) const
ImVec2 diwne2workArea(
const ImVec2 & point
) const
function DrawBurgerMenu
void DrawBurgerMenu(
ImDrawList * idl,
const ImColor & color,
const ImRect & rect,
const ImVec2 & padding,
float thickness
) const
void DrawBurgerMenu(
ImDrawList * idl,
const ImColor & color,
const ImRect & rect,
const ImVec2 & padding,
float thickness
) const
function drawGrid
void drawGrid(
bool dots,
float size,
ImVec4 color,
float fadeStart,
float fadeEnd,
bool ignoreZoom
) const
void drawGrid(
bool dots,
float size,
ImVec4 color,
float fadeStart,
float fadeEnd,
bool ignoreZoom
) const
function DrawIcon
void DrawIcon(
IconType bgIconType,
ImColor bgShapeColor,
ImColor bgInnerColor,
IconType fgIconType,
ImColor fgShapeColor,
ImColor fgInnerColor,
ImVec2 size,
ImVec4 padding,
bool filled,
ImVec2 thickness =ImVec2(1, 1),
float rounding =0
) const
void DrawIcon(
IconType bgIconType,
ImColor bgShapeColor,
ImColor bgInnerColor,
IconType fgIconType,
ImColor fgShapeColor,
ImColor fgInnerColor,
ImVec2 size,
ImVec4 padding,
bool filled,
ImVec2 thickness =ImVec2(1, 1),
float rounding =0
) const
Draw an Icon combined from two parts (foreground and background) to the window ImDrawList filled with a ShapeColor.
Parameters:
bgIconType background shape (typically a Rectangle)
bgShapeColor color of the background shape (or a border color if not filled)
bgInnerColor color of the background shape interior if filled == false
fgIconType foreground shape (typically a Triangle or Cross)
fgShapeColor color of the foreground shape if filled == false
fgInnerColor color of foreground shape interior if filled == false
size of the icon in screen coordinates
padding of the fg shape (left, bottom, right, top)
filled means
true fill both shapes with their ShapeColor
false draw both shapes with a ShapeColor border and fill them with InnerColor
Return: void
When filled == true, both shapes have a border. Then, the border color is the ShapeColor and the shape is filled with the InnerColor
The icon is drawn at the current ImGui cursor. This method does NOT advance the cursor.
function DrawIconCircle
void DrawIconCircle(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
void DrawIconCircle(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
Draw a circle icon.
Parameters:
- idl ImDrawList* where to draw
- shapeColor color of the whole shape (border line if not filled)
- innerColor color of the inner part (middle) of shape
- topLeft position of the icon in screen coords
- bottomRight of the icon in screen coords
- filled false means use the InnerColor in the foreground Shape
- thickness of the border for zoomFactor = 1.0
function DrawIconCross
void DrawIconCross(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float shapeThickness =2,
float innerThickness =1
) const
void DrawIconCross(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float shapeThickness =2,
float innerThickness =1
) const
function DrawIconFastForward
void DrawIconFastForward(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
void DrawIconFastForward(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
function DrawIconGrabDownLeft
void DrawIconGrabDownLeft(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
void DrawIconGrabDownLeft(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
function DrawIconGrabDownRight
void DrawIconGrabDownRight(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
void DrawIconGrabDownRight(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
function DrawIconHyphen
void DrawIconHyphen(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =3.0f
) const
void DrawIconHyphen(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =3.0f
) const
function DrawIconPause
void DrawIconPause(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
ImVec2 thickness =ImVec2(1, 1),
float rounding =0
) const
void DrawIconPause(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
ImVec2 thickness =ImVec2(1, 1),
float rounding =0
) const
function DrawIconRectangle
void DrawIconRectangle(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
ImVec2 thickness =ImVec2(1, 1),
float rounding =0
) const
void DrawIconRectangle(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
ImVec2 thickness =ImVec2(1, 1),
float rounding =0
) const
function DrawIconRewind
void DrawIconRewind(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
void DrawIconRewind(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
function DrawIconSkipBack
void DrawIconSkipBack(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
void DrawIconSkipBack(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
function DrawIconSkipBack2
void DrawIconSkipBack2(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
void DrawIconSkipBack2(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
function DrawIconSkipForward
void DrawIconSkipForward(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
void DrawIconSkipForward(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
function DrawIconSkipForward2
void DrawIconSkipForward2(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
void DrawIconSkipForward2(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
function DrawIconTriangleDownLeft
void DrawIconTriangleDownLeft(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
void DrawIconTriangleDownLeft(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
function DrawIconTriangleDownRight
void DrawIconTriangleDownRight(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
void DrawIconTriangleDownRight(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
function DrawIconTriangleLeft
void DrawIconTriangleLeft(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
void DrawIconTriangleLeft(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
function DrawIconTriangleRight
void DrawIconTriangleRight(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
void DrawIconTriangleRight(
ImDrawList * idl,
ImColor shapeColor,
ImColor innerColor,
ImVec2 topLeft,
ImVec2 bottomRight,
bool filled,
float thickness =1
) const
function EmptyButton
void EmptyButton(
ImVec2 size,
ImColor color,
float rounding
)
void EmptyButton(
ImVec2 size,
ImColor color,
float rounding
)
Just the shape of the button, no interaction.
Parameters:
- size
- color
- rounding
function ensureZoomScaling
bool ensureZoomScaling(
bool active
)
bool ensureZoomScaling(
bool active
)
Ensure that zoom scaling is active or not based on a passed parameter.
Return: Whether zoom scaling was active before making this call, can be later passed to this method again to restore original state
function getViewportRectDiwne
ImRect getViewportRectDiwne() const
ImRect getViewportRectDiwne() const
function getViewportRectScreen
ImRect getViewportRectScreen() const
ImRect getViewportRectScreen() const
function getZoom
float getZoom() const
float getZoom() const
function IconButton
bool IconButton(
IconType bgIconType,
ImColor bgShapeColor,
ImColor bgInnerColor,
ImVec2 size,
ImVec4 padding,
bool filled,
std::string id
) const
bool IconButton(
IconType bgIconType,
ImColor bgShapeColor,
ImColor bgInnerColor,
ImVec2 size,
ImVec4 padding,
bool filled,
std::string id
) const
Add ImGui Button with icon on it.
See: DrawIcon()
Return: true if interaction with button happen, false otherwise
function IconButton
bool IconButton(
std::string id,
bool disabled,
IconType bgIconType,
ImColor bgShapeColor,
ImColor bgInnerColor,
IconType fgIconType,
ImColor fgShapeColor,
ImColor fgInnerColor,
ImVec2 size,
ImVec4 padding,
bool filled,
ImVec2 thickness =ImVec2(1, 1),
float rounding =0
) const
bool IconButton(
std::string id,
bool disabled,
IconType bgIconType,
ImColor bgShapeColor,
ImColor bgInnerColor,
IconType fgIconType,
ImColor fgShapeColor,
ImColor fgInnerColor,
ImVec2 size,
ImVec4 padding,
bool filled,
ImVec2 thickness =ImVec2(1, 1),
float rounding =0
) const
Add ImGui Button with icon on it.
Parameters:
- disabled Disables the button, prevents presses and retaining of active id on drag, but still allows querying of hover state when wrapped in a ImGui group or with appropriate IsItemHovered flags.
See: DrawIcon()
Return: true if interaction with button happen, false otherwise
function IconButton2
bool IconButton2(
const std::string & id,
ImVec2 size,
bool disabled,
IconType bgIconType,
IconType fgIconType,
const IconStyle & style,
const IconStyle & hoveredStyle,
const IconStyle & activeStyle
) const
bool IconButton2(
const std::string & id,
ImVec2 size,
bool disabled,
IconType bgIconType,
IconType fgIconType,
const IconStyle & style,
const IconStyle & hoveredStyle,
const IconStyle & activeStyle
) const
// TODO: (DR) Docs, new IconButton that allows various styles depening on the button state (hover, maybe press) Add ImGui Button with icon on it
Parameters:
- disabled Disables the button, prevents presses and retaining of active id on drag, but still allows querying of hover state when wrapped in a ImGui group or with appropriate IsItemHovered flags.
See: DrawIcon()
Return: true if interaction with button happen, false otherwise
function moveViewport
void moveViewport(
const ImVec2 & distance
)
void moveViewport(
const ImVec2 & distance
)
function moveViewportZoomed
void moveViewportZoomed(
const ImVec2 & distance
)
void moveViewportZoomed(
const ImVec2 & distance
)
function screen2diwne
ImRect screen2diwne(
const ImRect & rect
) const
ImRect screen2diwne(
const ImRect & rect
) const
Convert screen rect to a diwne rect.
function screen2diwne
ImVec2 screen2diwne(
const ImVec2 & point
) const
ImVec2 screen2diwne(
const ImVec2 & point
) const
function screen2diwneSize
ImVec2 screen2diwneSize(
const ImVec2 & point
) const
ImVec2 screen2diwneSize(
const ImVec2 & point
) const
Revert diwne scaling factors from a ImVec2 size.
function screen2diwneSize
float screen2diwneSize(
float size
) const
float screen2diwneSize(
float size
) const
Revert diwne scaling factors from a float size.
function screen2workArea
ImVec2 screen2workArea(
const ImVec2 & point
) const
ImVec2 screen2workArea(
const ImVec2 & point
) const
function setViewportRectDiwne
void setViewportRectDiwne(
ImRect rect
)
void setViewportRectDiwne(
ImRect rect
)
function setZoom
virtual void setZoom(
float val
)
virtual void setZoom(
float val
)
function stopZoomScaling
bool stopZoomScaling()
bool stopZoomScaling()
Restores the current ImGuiStyle and Font back to its state before applyZoomScaling() was last called.
Return: Whether zoom scaling was active before making this call
function stopZoomScalingToFont
void stopZoomScalingToFont(
ImFont * font,
float originalScale
)
void stopZoomScalingToFont(
ImFont * font,
float originalScale
)
function updateViewportRects
void updateViewportRects()
void updateViewportRects()
Update screen and diwne positions and sizes of viewport.
function workArea2diwne
ImVec2 workArea2diwne(
const ImVec2 & point
) const
ImVec2 workArea2diwne(
const ImVec2 & point
) const
function workArea2screen
ImVec2 workArea2screen(
const ImVec2 & point
) const
ImVec2 workArea2screen(
const ImVec2 & point
) const
Protected Functions Documentation
function ScaleAllSizes
void ScaleAllSizes(
ImGuiStyle & style,
float scale_factor
)
void ScaleAllSizes(
ImGuiStyle & style,
float scale_factor
)
Public Attributes Documentation
variable m_prevZoom
float m_prevZoom;
float m_prevZoom;
Last frame zoom factor.
variable m_unscaledFontSize
float m_unscaledFontSize {16.f};
float m_unscaledFontSize {16.f};
Original font size.
variable m_viewRectDiwne
ImRect m_viewRectDiwne;
ImRect m_viewRectDiwne;
Bounds of the canvas viewport in canvas/editor's coordinates (diwne coordinates).
The top left corner (.Min) can be set manually, the bottom right corner (.Max) is determined by available space.
variable m_viewRectScreen
ImRect m_viewRectScreen;
ImRect m_viewRectScreen;
Viewport bounds in screen space coordinates.
variable m_zoom
float m_zoom;
float m_zoom;
Viewport zoom factor (scale ratio between diwne and screen coordinates).
variable m_zoomScalingApplied
bool m_zoomScalingApplied = false;
bool m_zoomScalingApplied = false;
Whether zoom UI scaling has been applied or not to Dear ImGui.
Protected Attributes Documentation
variable editor
NodeEditor & editor;
NodeEditor & editor;
variable m_zoomOriginalFontScale
float m_zoomOriginalFontScale;
float m_zoomOriginalFontScale;
Original font scale.
variable m_zoomOriginalStyle
ImGuiStyle m_zoomOriginalStyle;
ImGuiStyle m_zoomOriginalStyle;
Original ImGui style.
Updated on 2025-05-31 at 12:55:31 +0000