mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2026-03-21 19:56:11 +00:00
Compare commits
2 Commits
v0.25.1
...
3102bbe4c3
| Author | SHA1 | Date | |
|---|---|---|---|
| 3102bbe4c3 | |||
| 530e01d939 |
@@ -79,7 +79,19 @@ module CyberarmEngine
|
|||||||
end
|
end
|
||||||
|
|
||||||
def caret_position_under_mouse(mouse_x, mouse_y)
|
def caret_position_under_mouse(mouse_x, mouse_y)
|
||||||
active_line = row_at(mouse_y)
|
# get y scroll offset of element to get EditBox's selected row
|
||||||
|
y_scroll_offset = 0
|
||||||
|
e = parent
|
||||||
|
while (e)
|
||||||
|
if e.is_a?(Container)
|
||||||
|
y_scroll_offset += e.scroll_position.y
|
||||||
|
|
||||||
|
# root element has no parent so loop will terminate
|
||||||
|
e = e.parent
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
active_line = row_at(mouse_y - y_scroll_offset)
|
||||||
right_offset = column_at(mouse_x, mouse_y)
|
right_offset = column_at(mouse_x, mouse_y)
|
||||||
|
|
||||||
buffer = @text_input.text.lines[0..active_line].join if active_line != 0
|
buffer = @text_input.text.lines[0..active_line].join if active_line != 0
|
||||||
|
|||||||
@@ -271,10 +271,14 @@ module CyberarmEngine
|
|||||||
end
|
end
|
||||||
|
|
||||||
def redirect_scroll_jump_to(edge)
|
def redirect_scroll_jump_to(edge)
|
||||||
|
return if window.text_input
|
||||||
|
|
||||||
@mouse_over.publish(:"scroll_jump_to_#{edge}", window.mouse_x, window.mouse_y) if (@mouse_over && !@menu) || (@mouse_over && @mouse_over == @menu)
|
@mouse_over.publish(:"scroll_jump_to_#{edge}", window.mouse_x, window.mouse_y) if (@mouse_over && !@menu) || (@mouse_over && @mouse_over == @menu)
|
||||||
end
|
end
|
||||||
|
|
||||||
def redirect_scroll_page(edge)
|
def redirect_scroll_page(edge)
|
||||||
|
return if window.text_input
|
||||||
|
|
||||||
@mouse_over.publish(:"scroll_page_#{edge}", window.mouse_x, window.mouse_y) if (@mouse_over && !@menu) || (@mouse_over && @mouse_over == @menu)
|
@mouse_over.publish(:"scroll_page_#{edge}", window.mouse_x, window.mouse_y) if (@mouse_over && !@menu) || (@mouse_over && @mouse_over == @menu)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user