Skip to content

Commit

Permalink
bug fix for cut layers mode change
Browse files Browse the repository at this point in the history
  • Loading branch information
sava41 committed Nov 12, 2024
1 parent fca9948 commit 0010af5
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions source/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ namespace mc
{
submitEvent( Events::MergeEditLayers );
}

if( currentMode == Mode::Cut )
{
submitEvent( Events::DeleteEditLayers );
submitEvent( Events::Cut );
}
}

void setColorsUI()
Expand Down Expand Up @@ -256,7 +262,7 @@ namespace mc

void computeMouseLocationUI( const AppContext* app, glm::vec2 mouseWindowPos )
{
g_mouseLocationUI = ImGui::GetIO().WantCaptureMouse ? MouseLocationUI::Window : MouseLocationUI::None;
g_mouseLocationUI = MouseLocationUI::None;

if( app->selectionReady && app->layers.numSelected() > 0 )
{
Expand Down Expand Up @@ -285,6 +291,11 @@ namespace mc
g_mouseLocationUI = MouseLocationUI::MoveHandle;
}
}

if( ImGui::GetIO().WantCaptureMouse )
{
g_mouseLocationUI = MouseLocationUI::Window;
}
}

void computeTransformBox( const AppContext* app, glm::vec2 mouseWindowPos )
Expand Down Expand Up @@ -959,15 +970,13 @@ namespace mc
}
else if( app->mode == Mode::Cut )
{
ImGui::SetNextWindowPos( glm::vec2( buttonSpacing, app->height - 400 * g_uiScale - buttonSpacing ), ImGuiCond_Appearing );
ImGui::SetNextWindowSize( glm::vec2( 350.0, 400 ) * g_uiScale, ImGuiCond_FirstUseEver );
ImGui::SetNextWindowPos( glm::vec2( buttonSpacing, app->height - 150 * g_uiScale - buttonSpacing ), ImGuiCond_Appearing );
ImGui::SetNextWindowSize( glm::vec2( 350.0, 150 ) * g_uiScale, ImGuiCond_FirstUseEver );

ImGui::Begin( "Cut Image Via Painted Mask", nullptr,
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse );
{

ImGui::Image( (ImTextureID)(intptr_t)app->textureManager.get( *app->editMaskTextureHandle.get() ).textureView.Get(), ImVec2( 200, 200 ) );

ImGui::PushItemWidth( ImGui::GetContentRegionAvail().x );

ImGui::SliderFloat( "##Mask Paint Radius", &g_paintRadius, 0.0f, 200.0f );
Expand Down

0 comments on commit 0010af5

Please sign in to comment.