mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-04 08:46:09 +00:00
Unify slice/move_slice tools
This commit is contained in:
parent
fece0cf025
commit
097efa4cc2
10
data/gui.xml
10
data/gui.xml
@ -446,7 +446,6 @@
|
||||
<key tool="hand" shortcut="H" />
|
||||
<key tool="move" shortcut="V" />
|
||||
<key tool="slice" shortcut="C" />
|
||||
<key tool="move_slice" shortcut="C" />
|
||||
<key tool="zoom" shortcut="Z" />
|
||||
|
||||
<key tool="paint_bucket" shortcut="G" />
|
||||
@ -1135,15 +1134,6 @@
|
||||
intertwine="as_rectangles"
|
||||
tracepolicy="last"
|
||||
/>
|
||||
<tool id="move_slice"
|
||||
text="Move Slice Tool"
|
||||
fill="none"
|
||||
ink="move_slice"
|
||||
controller="two_points"
|
||||
pointshape="pixel"
|
||||
intertwine="as_rectangles"
|
||||
tracepolicy="last"
|
||||
/>
|
||||
</group>
|
||||
|
||||
<group id="paint_bucket" text="Paint Bucket Tool">
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
@ -388,7 +388,6 @@
|
||||
<part id="tool_jumble" x="176" y="112" w="16" h="16" />
|
||||
<part id="tool_configuration" x="144" y="128" w="16" h="16" />
|
||||
<part id="tool_minieditor" x="160" y="128" w="16" h="16" />
|
||||
<part id="tool_move_slice" x="224" y="48" w="16" h="16" />
|
||||
<part id="simple_color_border" x="16" y="32" w1="3" w2="6" w3="3" h1="3" h2="6" h3="3" />
|
||||
<part id="simple_color_selected" x="32" y="32" w1="3" w2="6" w3="3" h1="3" h2="6" h3="3" />
|
||||
</parts>
|
||||
|
@ -64,7 +64,6 @@ namespace app {
|
||||
|
||||
// Returns true if this ink is used to mark slices
|
||||
virtual bool isSlice() const { return false; }
|
||||
virtual bool isMoveSlice() const { return false; }
|
||||
|
||||
// Returns true if inkHline() needs source cel coordinates
|
||||
// instead of sprite coordinates (i.e. relative to
|
||||
|
@ -209,39 +209,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class MoveSliceInk : public Ink {
|
||||
AlgoHLine m_proc;
|
||||
bool m_selectSlices;
|
||||
|
||||
public:
|
||||
MoveSliceInk() {
|
||||
m_selectSlices = false;
|
||||
}
|
||||
|
||||
Ink* clone() override { return new MoveSliceInk(*this); }
|
||||
|
||||
bool isSlice() const override { return true; }
|
||||
bool isMoveSlice() const override { return true; }
|
||||
bool needsCelCoordinates() const override { return false; }
|
||||
|
||||
void prepareInk(ToolLoop* loop) override {
|
||||
m_proc = get_ink_proc<XorInkProcessing>(loop->sprite()->pixelFormat());
|
||||
}
|
||||
|
||||
void inkHline(int x1, int y, int x2, ToolLoop* loop) override {
|
||||
if (m_selectSlices) {
|
||||
// TODO
|
||||
}
|
||||
else
|
||||
(*m_proc)(x1, y, x2, loop);
|
||||
}
|
||||
|
||||
void setFinalStep(ToolLoop* loop, bool state) override {
|
||||
m_selectSlices = state;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class EraserInk : public Ink {
|
||||
public:
|
||||
enum Type { Eraser, ReplaceFgWithBg, ReplaceBgWithFg };
|
||||
|
@ -99,7 +99,6 @@ ToolBox::ToolBox()
|
||||
m_inks[WellKnownInks::Scroll] = new ScrollInk();
|
||||
m_inks[WellKnownInks::Move] = new MoveInk();
|
||||
m_inks[WellKnownInks::Slice] = new SliceInk();
|
||||
m_inks[WellKnownInks::MoveSlice] = new MoveSliceInk();
|
||||
m_inks[WellKnownInks::Blur] = new BlurInk();
|
||||
m_inks[WellKnownInks::Jumble] = new JumbleInk();
|
||||
|
||||
|
@ -1853,17 +1853,9 @@ EditorHit Editor::calcHit(const gfx::Point& mouseScreenPos)
|
||||
gfx::Rect bounds = editorToScreen(key->bounds());
|
||||
gfx::Rect center = key->center();
|
||||
|
||||
// Only move slice
|
||||
if (ink->isMoveSlice()) {
|
||||
if (bounds.contains(mouseScreenPos)) {
|
||||
EditorHit hit(EditorHit::SliceBounds);
|
||||
hit.setBorder(CENTER | MIDDLE);
|
||||
hit.setSlice(slice);
|
||||
return hit;
|
||||
}
|
||||
}
|
||||
else if (bounds.contains(mouseScreenPos) &&
|
||||
!bounds.shrink(5*guiscale()).contains(mouseScreenPos)) {
|
||||
// Move bounds
|
||||
if (bounds.contains(mouseScreenPos) &&
|
||||
!bounds.shrink(5*guiscale()).contains(mouseScreenPos)) {
|
||||
int border =
|
||||
(mouseScreenPos.x <= bounds.x ? LEFT: 0) |
|
||||
(mouseScreenPos.y <= bounds.y ? TOP: 0) |
|
||||
@ -1875,7 +1867,9 @@ EditorHit Editor::calcHit(const gfx::Point& mouseScreenPos)
|
||||
hit.setSlice(slice);
|
||||
return hit;
|
||||
}
|
||||
else if (!center.isEmpty()) {
|
||||
|
||||
// Move center
|
||||
if (!center.isEmpty()) {
|
||||
center = editorToScreen(
|
||||
center.offset(key->bounds().origin()));
|
||||
|
||||
@ -1896,6 +1890,14 @@ EditorHit Editor::calcHit(const gfx::Point& mouseScreenPos)
|
||||
return hit;
|
||||
}
|
||||
}
|
||||
|
||||
// Move all the slice
|
||||
if (bounds.contains(mouseScreenPos)) {
|
||||
EditorHit hit(EditorHit::SliceBounds);
|
||||
hit.setBorder(CENTER | MIDDLE);
|
||||
hit.setSlice(slice);
|
||||
return hit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user