Compare commits

...

3 Commits

Author SHA1 Message Date
Gaspar Capello de85332a9a
Merge 5afa9e6b82 into 41e5097c33 2025-09-30 12:26:18 +05:30
Joshua Lopez 41e5097c33 Fix mouse gestures not working after switching tabs (fix aseprite#4388)
build / build (Debug, macos-latest, lua, cli) (push) Waiting to run Details
build / build (Debug, macos-latest, noscripts, cli) (push) Waiting to run Details
build / build (Debug, ubuntu-latest, lua, cli) (push) Waiting to run Details
build / build (Debug, ubuntu-latest, noscripts, cli) (push) Waiting to run Details
build / build (Debug, windows-latest, lua, cli) (push) Waiting to run Details
build / build (Debug, windows-latest, noscripts, cli) (push) Waiting to run Details
build / build (RelWithDebInfo, macos-latest, lua, gui) (push) Waiting to run Details
build / build (RelWithDebInfo, ubuntu-latest, lua, gui) (push) Waiting to run Details
build / build (RelWithDebInfo, windows-latest, lua, gui) (push) Waiting to run Details
2025-09-29 18:06:45 -03:00
Gaspar Capello 5afa9e6b82 Improper use of pickColor to get the top layer
PickColor was replaced by pickCels in some places in the code because
only the top layer was required; the color was ignored.
Additionally, the RenderPlan for those pickColors (and now pickCels)
was incorrectly initialized for the AutoSelect Layer. Now is fixed.
2025-09-26 17:28:19 -03:00
4 changed files with 26 additions and 17 deletions

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2019-2024 Igara Studio S.A.
// Copyright (C) 2019-2025 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@ -104,7 +104,7 @@ void ColorPicker::pickColor(const Site& site,
switch (mode) {
// Pick from the composed image
case FromComposition: {
doc::RenderPlan plan(pref.experimental.composeGroups());
doc::RenderPlan plan;
plan.addLayer(sprite->root(), site.frame());
doc::CelList cels;

View File

@ -61,6 +61,7 @@
#include "base/scoped_value.h"
#include "doc/doc.h"
#include "doc/mask_boundaries.h"
#include "doc/render_plan.h"
#include "doc/slice.h"
#include "fmt/format.h"
#include "os/color_space.h"
@ -3097,13 +3098,16 @@ void Editor::updateAutoCelGuides(ui::Message* msg)
// tool to show automatic guides.
if (m_showAutoCelGuides && m_state->allowLayerEdges()) {
auto mouseMsg = dynamic_cast<ui::MouseMessage*>(msg);
ColorPicker picker;
picker.pickColor(getSite(),
screenToEditorF(mouseMsg ? mouseMsg->position() : mousePosInDisplay()),
m_proj,
ColorPicker::FromComposition);
m_showGuidesThisCel = (picker.layer() ? picker.layer()->cel(m_frame) : nullptr);
doc::RenderPlan plan;
Sprite* sprite = getSite().sprite();
plan.addLayer(sprite->root(), getSite().frame());
doc::CelList cels;
sprite->pickCels(screenToEditorF(mouseMsg ? mouseMsg->position() : mousePosInDisplay()),
1,
plan,
cels);
m_showGuidesThisCel =
((!cels.empty() && cels.front()->layer()) ? cels.front()->layer()->cel(m_frame) : nullptr);
}
else {
m_showGuidesThisCel = nullptr;

View File

@ -60,6 +60,7 @@
#include "doc/layer.h"
#include "doc/layer_tilemap.h"
#include "doc/mask.h"
#include "doc/render_plan.h"
#include "doc/slice.h"
#include "doc/sprite.h"
#include "fmt/format.h"
@ -153,16 +154,15 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg)
// Handle "Auto Select Layer"
if (editor->isAutoSelectLayer()) {
gfx::PointF cursor = editor->screenToEditorF(msg->position());
ColorPicker picker;
picker.pickColor(site, cursor, editor->projection(), ColorPicker::FromComposition);
RenderPlan plan;
plan.addLayer(site.sprite()->root(), site.frame());
doc::CelList cels;
site.sprite()->pickCels(cursor, 1, plan, cels);
const view::RealRange& range = context->range();
if (picker.layer() && !range.contains(picker.layer())) {
layer = picker.layer();
if (layer) {
editor->setLayer(layer);
editor->flashCurrentLayer();
}
if (!cels.empty() && cels.front()->layer() && !range.contains(cels.front()->layer())) {
editor->setLayer(cels.front()->layer());
editor->flashCurrentLayer();
}
}

View File

@ -25,6 +25,7 @@
#include "app/ui/workspace.h"
#include "app/ui/workspace_tabs.h"
#include "doc/sprite.h"
#include "ui/manager.h"
#include "ui/system.h"
#include <algorithm>
@ -120,6 +121,10 @@ void UIContext::setActiveView(DocView* docView)
mainWin->getTimeline()->updateUsingEditor(editor);
mainWin->getPreviewEditor()->updateUsingEditor(editor);
// Update mouse widgets immediately after changing views rather
// than waiting for mouse movement.
mainWin->manager()->_updateMouseWidgets();
// Change the image-type of color bar.
ColorBar::instance()->setPixelFormat(app_get_current_pixel_format());