@ -1971,7 +1971,7 @@ static void SetCurrentWindow(ImGuiWindow* window)
ImGuiContext & g = * GImGui ;
g . CurrentWindow = window ;
if ( window )
g . FontSize = window- > CalcFontSize ( ) ;
g . FontSize = g. DrawListSharedData . FontSize = window- > CalcFontSize ( ) ;
}
static void SetNavID ( ImGuiID id , int nav_layer )
@ -3254,8 +3254,9 @@ void ImGui::NewFrame()
g . OsImePosRequest = ImVec2 ( 1.0f , 1.0f ) ; // OS Input Method Editor showing on top-left of our window by default
// If mouse was first clicked outside of ImGui bounds we also cancel out hovering.
// FIXME: For patterns of drag and drop between "application" and "imgui" we may need to rework/remove this test (first committed 311c0ca9 on 2015/02)
if ( ! mouse_avail_to_imgui )
// FIXME: For patterns of drag and drop across OS windows, we may need to rework/remove this test (first committed 311c0ca9 on 2015/02)
bool mouse_dragging_extern_payload = g . DragDropActive & & ( g . DragDropSourceFlags & ImGuiDragDropFlags_SourceExtern ) ! = 0 ;
if ( ! mouse_avail_to_imgui & & ! mouse_dragging_extern_payload )
g . HoveredWindow = g . HoveredRootWindow = NULL ;
// Scale & Scrolling
@ -6817,7 +6818,7 @@ void ImGui::SetWindowFontScale(float scale)
ImGuiContext & g = * GImGui ;
ImGuiWindow * window = GetCurrentWindow ( ) ;
window - > FontWindowScale = scale ;
g . FontSize = window- > CalcFontSize ( ) ;
g . FontSize = g. DrawListSharedData . FontSize = window- > CalcFontSize ( ) ;
}
// User generally sees positions in window coordinates. Internally we store CursorPos in absolute screen coordinates because it is more convenient.
@ -12035,9 +12036,11 @@ static float OffsetNormToPixels(const ImGuiColumnsSet* columns, float offset_nor
static float PixelsToOffsetNorm ( const ImGuiColumnsSet * columns , float offset )
{
return ( offset - columns - > MinX ) / ( columns - > MaxX - columns - > MinX ) ;
return offset / ( columns - > MaxX - columns - > MinX ) ;
}
static inline float GetColumnsRectHalfWidth ( ) { return 4.0f ; }
static float GetDraggedColumnOffset ( ImGuiColumnsSet * columns , int column_index )
{
// Active (dragged) column always follow mouse. The reason we need this is that dragging a column to the right edge of an auto-resizing
@ -12047,7 +12050,7 @@ static float GetDraggedColumnOffset(ImGuiColumnsSet* columns, int column_index)
IM_ASSERT ( column_index > 0 ) ; // We cannot drag column 0. If you get this assert you may have a conflict between the ID of your columns and another widgets.
IM_ASSERT ( g . ActiveId = = columns - > ID + ImGuiID ( column_index ) ) ;
float x = g . IO . MousePos . x - g . ActiveIdClickOffset . x - window - > Pos . x ;
float x = g . IO . MousePos . x - g . ActiveIdClickOffset . x + GetColumnsRectHalfWidth ( ) - window - > Pos . x ;
x = ImMax ( x , ImGui : : GetColumnOffset ( column_index - 1 ) + g . Style . ColumnsMinSpacing ) ;
if ( ( columns - > Flags & ImGuiColumnsFlags_NoPreserveWidths ) )
x = ImMin ( x , ImGui : : GetColumnOffset ( column_index + 1 ) - g . Style . ColumnsMinSpacing ) ;
@ -12120,7 +12123,7 @@ void ImGui::SetColumnOffset(int column_index, float offset)
if ( ! ( columns - > Flags & ImGuiColumnsFlags_NoForceWithinWindow ) )
offset = ImMin ( offset , columns - > MaxX - g . Style . ColumnsMinSpacing * ( columns - > Count - column_index ) ) ;
columns - > Columns [ column_index ] . OffsetNorm = PixelsToOffsetNorm ( columns , offset ) ;
columns - > Columns [ column_index ] . OffsetNorm = PixelsToOffsetNorm ( columns , offset - columns - > MinX ) ;
if ( preserve_width )
SetColumnOffset ( column_index + 1 , offset + ImMax ( g . Style . ColumnsMinSpacing , width ) ) ;
@ -12184,7 +12187,7 @@ void ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiColumnsFlag
// Set state for first column
const float content_region_width = ( window - > SizeContentsExplicit . x ! = 0.0f ) ? ( window - > SizeContentsExplicit . x ) : ( window - > Size . x - window - > ScrollbarSizes . x ) ;
columns - > MinX = window - > DC . IndentX - g . Style . ItemSpacing . x ; // Lock our horizontal range
//column-> Columns MaxX = content_region_width - window->Scroll.x -((window->Flags & ImGuiWindowFlags_NoScrollbar) ? 0 : g.Style.ScrollbarSize);// - window->WindowPadding().x;
//column-> MaxX = content_region_width - window->Scroll.x - ((window->Flags & ImGuiWindowFlags_NoScrollbar) ? 0 : g.Style.ScrollbarSize);// - window->WindowPadding().x;
columns - > MaxX = content_region_width - window - > Scroll . x ;
columns - > StartPosY = window - > DC . CursorPos . y ;
columns - > StartMaxPosX = window - > DC . CursorMaxPos . x ;
@ -12212,7 +12215,7 @@ void ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiColumnsFlag
ImGuiColumnData * column = & columns - > Columns [ n ] ;
float t = column - > OffsetNorm ;
if ( ! ( columns - > Flags & ImGuiColumnsFlags_NoForceWithinWindow ) )
t = ImMin ( t , PixelsToOffsetNorm ( columns , columns - > MaxX - g . Style . ColumnsMinSpacing * ( columns - > Count - n ) ) ) ;
t = ImMin ( t , PixelsToOffsetNorm ( columns , ( columns - > MaxX - columns - > MinX ) - g . Style . ColumnsMinSpacing * ( columns - > Count - n ) ) ) ;
column - > OffsetNorm = t ;
if ( n = = columns_count )
@ -12257,7 +12260,7 @@ void ImGui::EndColumns()
{
float x = window - > Pos . x + GetColumnOffset ( n ) ;
const ImGuiID column_id = columns - > ID + ImGuiID ( n ) ;
const float column_hw = 4.0f ; // Half-width for interaction
const float column_hw = GetColumnsRectHalfWidth ( ) ; // Half-width for interaction
const ImRect column_rect ( ImVec2 ( x - column_hw , y1 ) , ImVec2 ( x + column_hw , y2 ) ) ;
KeepAliveID ( column_id ) ;
if ( IsClippedEx ( column_rect , column_id , false ) )
@ -12269,8 +12272,6 @@ void ImGui::EndColumns()
ButtonBehavior ( column_rect , column_id , & hovered , & held ) ;
if ( hovered | | held )
g . MouseCursor = ImGuiMouseCursor_ResizeEW ;
if ( held & & g . ActiveIdIsJustActivated )
g . ActiveIdClickOffset . x - = column_hw ; // Store from center of column line (we used a 8 wide rect for columns clicking). This is used by GetDraggedColumnOffset().
if ( held & & ! ( columns - > Columns [ n ] . Flags & ImGuiColumnsFlags_NoResize ) )
dragging_column = n ;
}