mirror of
https://github.com/aseprite/aseprite.git
synced 2024-12-29 09:23:32 +00:00
Open new sprites in the center of the current sprite.
This commit is contained in:
parent
73d7c608a1
commit
18db7513a8
1
TODO.txt
1
TODO.txt
@ -1,7 +1,6 @@
|
||||
For next release
|
||||
----------------
|
||||
|
||||
+ After creating or opening a sprite, it should be shown centered in the editor.
|
||||
+ Mini-look for sliders in palette editor (add ISliderBackground to draw RGB/HSV sliders
|
||||
with a customized background).
|
||||
+ Fix palette editor to avoid generating a lot of consecutive Undo actions.
|
||||
|
@ -425,6 +425,7 @@ SpriteImpl::SpriteImpl(Sprite* sprite, int imgtype, int width, int height, int n
|
||||
m_preferred.scroll_x = 0;
|
||||
m_preferred.scroll_y = 0;
|
||||
m_preferred.zoom = 0;
|
||||
m_preferred.virgin = true;
|
||||
|
||||
// Generate palette
|
||||
Palette pal(0, ncolors);
|
||||
|
@ -41,6 +41,7 @@ struct PreferredEditorSettings
|
||||
int scroll_x;
|
||||
int scroll_y;
|
||||
int zoom;
|
||||
bool virgin;
|
||||
};
|
||||
|
||||
typedef std::vector<Palette*> PalettesList;
|
||||
|
@ -159,6 +159,20 @@ void Editor::editor_set_sprite(Sprite* sprite)
|
||||
m_zoom = preferred.zoom;
|
||||
|
||||
editor_update();
|
||||
|
||||
if (preferred.virgin) {
|
||||
JWidget view = jwidget_get_view(this);
|
||||
JRect vp = jview_get_viewport_position(view);
|
||||
|
||||
preferred.virgin = false;
|
||||
preferred.scroll_x = -jrect_w(vp)/2 + (sprite->getWidth()/2);
|
||||
preferred.scroll_y = -jrect_h(vp)/2 + (sprite->getHeight()/2);
|
||||
|
||||
m_sprite->setPreferredEditorSettings(preferred);
|
||||
|
||||
jrect_free(vp);
|
||||
}
|
||||
|
||||
editor_set_scroll(m_offset_x + preferred.scroll_x,
|
||||
m_offset_y + preferred.scroll_y,
|
||||
false);
|
||||
|
Loading…
Reference in New Issue
Block a user