Skip to content

Commit 66504b6

Browse files
authored
fix struct field reference (#578)
1 parent 230887b commit 66504b6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/interface_drag_drop.v

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct Dragger {
5454
pub mut:
5555
typ string
5656
activated bool
57-
widget Draggable = button()
57+
widget &Draggable = button()
5858
start_x f64
5959
start_y f64
6060
pos_x f64
@@ -69,15 +69,15 @@ NB: would like external mechanism only depending on point_inside methods of Widg
6969
shift key (or other) to activate possible dragging
7070
*/
7171

72-
fn drag_register(d Draggable, e &MouseEvent) bool {
72+
fn drag_register(d &Draggable, e &MouseEvent) bool {
7373
if shift_key(e.mods) {
7474
$if drag ? {
7575
println('drag ${typeof(w).name}')
7676
}
7777
mut window := d.get_window()
7878
if window.dragger.activated {
7979
if d.z_index > window.dragger.widget.z_index {
80-
window.dragger.widget = d
80+
window.dragger.widget = unsafe { d }
8181
window.dragger.start_x = e.x - d.offset_x
8282
window.dragger.start_y = e.y - d.offset_y
8383
// println('drag: ($e.x, $e.y, ${window.dragger.start_x},${window.dragger.start_y})')
@@ -88,7 +88,7 @@ fn drag_register(d Draggable, e &MouseEvent) bool {
8888
} else {
8989
window.dragger.activated = true
9090
window.mouse.start('blue')
91-
window.dragger.widget = d
91+
window.dragger.widget = unsafe { d }
9292
window.dragger.start_x = e.x - d.offset_x
9393
window.dragger.start_y = e.y - d.offset_y
9494
// println('drag: ($e.x, $e.y, ${window.dragger.start_x},${window.dragger.start_y})')

0 commit comments

Comments
 (0)