mirror of https://github.com/aseprite/aseprite.git
				
				
				
			Fix calculation last drawable layer and last drawable frame
This commit is contained in:
		
							parent
							
								
									5e86884f74
								
							
						
					
					
						commit
						9dcadcf283
					
				|  | @ -340,7 +340,7 @@ bool PaletteView::onProcessMessage(Message* msg) | ||||||
|             m_delegate->onPaletteViewIndexChange(idx, buttons); |             m_delegate->onPaletteViewIndexChange(idx, buttons); | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|        | 
 | ||||||
|       if (m_state == State::DRAGGING_OUTLINE && |       if (m_state == State::DRAGGING_OUTLINE && | ||||||
|           m_hot.part == Hit::COLOR) { |           m_hot.part == Hit::COLOR) { | ||||||
|         update_scroll(m_hot.color); |         update_scroll(m_hot.color); | ||||||
|  |  | ||||||
|  | @ -1831,11 +1831,11 @@ void Timeline::setCursor(ui::Message* msg, const Hit& hit) | ||||||
| 
 | 
 | ||||||
| void Timeline::getDrawableLayers(layer_t* firstLayer, layer_t* lastLayer) | void Timeline::getDrawableLayers(layer_t* firstLayer, layer_t* lastLayer) | ||||||
| { | { | ||||||
|   int hpx = (clientBounds().h - headerBoxHeight() - topHeight()); |   layer_t i = this->lastLayer() | ||||||
|   layer_t i = this->lastLayer() - ((viewScroll().y+hpx) / layerBoxHeight()); |             - ((viewScroll().y + getCelsBounds().h) / layerBoxHeight()); | ||||||
|   i = MID(this->firstLayer(), i, this->lastLayer()); |   i = MID(this->firstLayer(), i, this->lastLayer()); | ||||||
| 
 | 
 | ||||||
|   layer_t j = i + (hpx / layerBoxHeight() + 1); |   layer_t j = this->lastLayer() - viewScroll().y / layerBoxHeight();; | ||||||
|   if (!m_rows.empty()) |   if (!m_rows.empty()) | ||||||
|     j = MID(this->firstLayer(), j, this->lastLayer()); |     j = MID(this->firstLayer(), j, this->lastLayer()); | ||||||
|   else |   else | ||||||
|  | @ -1847,12 +1847,9 @@ void Timeline::getDrawableLayers(layer_t* firstLayer, layer_t* lastLayer) | ||||||
| 
 | 
 | ||||||
| void Timeline::getDrawableFrames(frame_t* firstFrame, frame_t* lastFrame) | void Timeline::getDrawableFrames(frame_t* firstFrame, frame_t* lastFrame) | ||||||
| { | { | ||||||
|   int availW = (clientBounds().w - m_separator_x); |  | ||||||
| 
 |  | ||||||
|   *firstFrame = frame_t(viewScroll().x / frameBoxWidth()); |   *firstFrame = frame_t(viewScroll().x / frameBoxWidth()); | ||||||
|   *lastFrame = *firstFrame |   *lastFrame = frame_t((viewScroll().x | ||||||
|     + frame_t(availW / frameBoxWidth()) |       + getCelsBounds().w) / frameBoxWidth()); | ||||||
|     + ((availW % frameBoxWidth()) > 0 ? 1: 0); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Timeline::drawPart(ui::Graphics* g, const gfx::Rect& bounds, | void Timeline::drawPart(ui::Graphics* g, const gfx::Rect& bounds, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue