Beispiel #1
0
void
EditorScrollerWidget::update(float dt_sec)
{
  if (!rendered) return;
  if (!can_scroll()) return;

  m_editor.scroll(m_scrolling_vec * 32.0f * dt_sec);
}
Beispiel #2
0
void
EditorScroller::update(float elapsed_time) {
  if (!rendered) return;
  if (!can_scroll()) return;

  float horiz_scroll = scrolling_vec.x * elapsed_time;
  float vert_scroll = scrolling_vec.y * elapsed_time;
  auto editor = Editor::current();

  if (horiz_scroll < 0)
    editor->scroll_left(-horiz_scroll);
  else if (horiz_scroll > 0)
    editor->scroll_right(horiz_scroll);

  if (vert_scroll < 0)
    editor->scroll_up(-vert_scroll);
  else if (vert_scroll > 0)
    editor->scroll_down(vert_scroll);
}
Beispiel #3
0
void
EditorScroller::draw(DrawingContext& context) {
  if (!rendered) return;

  context.draw_filled_rect(Rectf(Vector(0, 0), Vector(SIZE, SIZE)),
                           Color(0.9f, 0.9f, 1.0f, 0.6f),
                           MIDDLE, LAYER_GUI-10);
  context.draw_filled_rect(Rectf(Vector(40, 40), Vector(56, 56)),
                           Color(0.9f, 0.9f, 1.0f, 0.6f),
                           8, LAYER_GUI-20);
  if (can_scroll()) {
    draw_arrow(context, mouse_pos);
  }

  draw_arrow(context, Vector(TOPLEFT, MIDDLE));
  draw_arrow(context, Vector(BOTTOMRIGHT, MIDDLE));
  draw_arrow(context, Vector(MIDDLE, TOPLEFT));
  draw_arrow(context, Vector(MIDDLE, BOTTOMRIGHT));
}
void BlockListUI_Base::update_viewport_pos(int p_new_line) {
	
	if (p_new_line==current_line )
		return;
	
	if (!can_scroll()) {
		update();
		current_line=p_new_line;
//		printf("cant scroll!\n");
		return;
		
	}
		
	int diff=p_new_line-current_line;
	fix_pre_scroll( diff );
	int scroll_pixels=-VisualSettings::get_singleton()->get_editing_row_height()*diff;
//	printf("scroll %i pixels\n",scroll_pixels);
	scroll(0,scroll_pixels);
	
	current_line=p_new_line;
	
}