mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-16 05:42:32 +00:00
Merge branch 'beta'
This commit is contained in:
commit
6f40c8bd35
@ -18,6 +18,7 @@
|
|||||||
<dim id="timeline_outline_width" value="2" />
|
<dim id="timeline_outline_width" value="2" />
|
||||||
<dim id="palette_outline_width" value="3" />
|
<dim id="palette_outline_width" value="3" />
|
||||||
<dim id="color_slider_height" value="14" />
|
<dim id="color_slider_height" value="14" />
|
||||||
|
<dim id="timeline_base_size" value="12" />
|
||||||
</dimensions>
|
</dimensions>
|
||||||
|
|
||||||
<colors>
|
<colors>
|
||||||
|
@ -145,9 +145,6 @@ Timeline::Timeline()
|
|||||||
, m_offset_count(0)
|
, m_offset_count(0)
|
||||||
, m_scroll(false)
|
, m_scroll(false)
|
||||||
, m_fromTimeline(false)
|
, m_fromTimeline(false)
|
||||||
, m_thumbnailsOverlayVisible(false)
|
|
||||||
, m_thumbnailsOverlayDirection(int(frameBoxWidth()*1.0),
|
|
||||||
int(frameBoxWidth()*0.5))
|
|
||||||
{
|
{
|
||||||
enableFlags(CTRL_RIGHT_CLICK);
|
enableFlags(CTRL_RIGHT_CLICK);
|
||||||
|
|
||||||
@ -181,13 +178,26 @@ Timeline::~Timeline()
|
|||||||
void Timeline::setZoom(double zoom)
|
void Timeline::setZoom(double zoom)
|
||||||
{
|
{
|
||||||
m_zoom = MID(1.0, zoom, 10.0);
|
m_zoom = MID(1.0, zoom, 10.0);
|
||||||
|
m_thumbnailsOverlayDirection = gfx::Point(int(frameBoxWidth()*1.0), int(frameBoxWidth()*0.5));
|
||||||
|
m_thumbnailsOverlayVisible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Timeline::setZoomAndUpdate(double zoom)
|
||||||
|
{
|
||||||
|
if (zoom != m_zoom) {
|
||||||
|
setZoom(zoom);
|
||||||
|
updateScrollBars();
|
||||||
|
setViewScroll(viewScroll());
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
if (zoom != docPref().thumbnails.zoom()) {
|
||||||
|
docPref().thumbnails.zoom(zoom);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timeline::onThumbnailsPrefChange()
|
void Timeline::onThumbnailsPrefChange()
|
||||||
{
|
{
|
||||||
setZoom(docPref().thumbnails.zoom());
|
setZoomAndUpdate(docPref().thumbnails.zoom());
|
||||||
m_thumbnailsOverlayDirection = gfx::Point(int(frameBoxWidth()*1.0), int(frameBoxWidth()*0.5));
|
|
||||||
invalidate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timeline::updateUsingEditor(Editor* editor)
|
void Timeline::updateUsingEditor(Editor* editor)
|
||||||
@ -1055,23 +1065,35 @@ bool Timeline::onProcessMessage(Message* msg)
|
|||||||
|
|
||||||
case kMouseWheelMessage:
|
case kMouseWheelMessage:
|
||||||
if (m_document) {
|
if (m_document) {
|
||||||
int dz = static_cast<MouseMessage*>(msg)->wheelDelta().y;
|
int base_size = skinTheme()->dimensions.timelineBaseSize();
|
||||||
int dx = 0;
|
int dz = static_cast<MouseMessage*>(msg)->wheelDelta().y * base_size;
|
||||||
int dy = 0;
|
|
||||||
|
|
||||||
dx += static_cast<MouseMessage*>(msg)->wheelDelta().x;
|
if (msg->altPressed()) {
|
||||||
|
if (dz != 0) {
|
||||||
if (msg->ctrlPressed())
|
double next_zoom = m_zoom + (dz < 0 ? 1 : -1);
|
||||||
dx = dz * frameBoxWidth();
|
setZoomAndUpdate(next_zoom);
|
||||||
else
|
}
|
||||||
dy = dz * layerBoxHeight();
|
|
||||||
|
|
||||||
if (msg->shiftPressed()) {
|
|
||||||
dx *= 3;
|
|
||||||
dy *= 3;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
int dx;
|
||||||
|
int dy;
|
||||||
|
|
||||||
setViewScroll(viewScroll() + gfx::Point(dx, dy));
|
if (msg->ctrlPressed()) {
|
||||||
|
dx = dz;
|
||||||
|
dy = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dx = static_cast<MouseMessage*>(msg)->wheelDelta().x * base_size;
|
||||||
|
dy = dz;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (msg->shiftPressed()) {
|
||||||
|
dx *= frameBoxWidth() / base_size;
|
||||||
|
dy *= layerBoxHeight() / base_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
setViewScroll(viewScroll() + gfx::Point(dx, dy));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1083,8 +1105,7 @@ bool Timeline::onProcessMessage(Message* msg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case kTouchMagnifyMessage:
|
case kTouchMagnifyMessage:
|
||||||
setZoom(m_zoom + m_zoom * static_cast<ui::TouchMessage*>(msg)->magnification());
|
setZoomAndUpdate(m_zoom + m_zoom * static_cast<ui::TouchMessage*>(msg)->magnification());
|
||||||
invalidate();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3020,22 +3041,22 @@ gfx::Size Timeline::celBoxSize() const
|
|||||||
|
|
||||||
int Timeline::headerBoxWidth() const
|
int Timeline::headerBoxWidth() const
|
||||||
{
|
{
|
||||||
return int(12 * guiscale());
|
return int(skinTheme()->dimensions.timelineBaseSize() * guiscale());
|
||||||
}
|
}
|
||||||
|
|
||||||
int Timeline::headerBoxHeight() const
|
int Timeline::headerBoxHeight() const
|
||||||
{
|
{
|
||||||
return int(12 * guiscale());
|
return int(skinTheme()->dimensions.timelineBaseSize() * guiscale());
|
||||||
}
|
}
|
||||||
|
|
||||||
int Timeline::layerBoxHeight() const
|
int Timeline::layerBoxHeight() const
|
||||||
{
|
{
|
||||||
return int(m_zoom*12*guiscale() + (int)(m_zoom > 1) * headerBoxHeight());
|
return int(m_zoom*skinTheme()->dimensions.timelineBaseSize()*guiscale() + (int)(m_zoom > 1) * headerBoxHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
int Timeline::frameBoxWidth() const
|
int Timeline::frameBoxWidth() const
|
||||||
{
|
{
|
||||||
return int(m_zoom*12*guiscale());
|
return int(m_zoom*skinTheme()->dimensions.timelineBaseSize()*guiscale());
|
||||||
}
|
}
|
||||||
|
|
||||||
int Timeline::outlineWidth() const
|
int Timeline::outlineWidth() const
|
||||||
|
@ -311,6 +311,7 @@ namespace app {
|
|||||||
void drawCelOverlay(ui::Graphics* g);
|
void drawCelOverlay(ui::Graphics* g);
|
||||||
void onThumbnailsPrefChange();
|
void onThumbnailsPrefChange();
|
||||||
void setZoom(double zoom);
|
void setZoom(double zoom);
|
||||||
|
void setZoomAndUpdate(double zoom);
|
||||||
|
|
||||||
ui::ScrollBar m_hbar;
|
ui::ScrollBar m_hbar;
|
||||||
ui::ScrollBar m_vbar;
|
ui::ScrollBar m_vbar;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user