@@ -2314,7 +2314,9 @@ impl<'gc> TInteractiveObject<'gc> for EditText<'gc> {
2314
2314
event : ClipEvent ,
2315
2315
) -> ClipEventResult {
2316
2316
match event {
2317
- ClipEvent :: Press | ClipEvent :: MouseWheel { .. } => ClipEventResult :: Handled ,
2317
+ ClipEvent :: Press | ClipEvent :: MouseWheel { .. } | ClipEvent :: MouseMove => {
2318
+ ClipEventResult :: Handled
2319
+ }
2318
2320
_ => ClipEventResult :: NotHandled ,
2319
2321
}
2320
2322
}
@@ -2339,44 +2341,61 @@ impl<'gc> TInteractiveObject<'gc> for EditText<'gc> {
2339
2341
return ClipEventResult :: Handled ;
2340
2342
}
2341
2343
2342
- if self . is_editable ( ) || self . is_selectable ( ) {
2343
- let tracker = context. focus_tracker ;
2344
- tracker. set ( Some ( self . into ( ) ) , context) ;
2345
- }
2344
+ if let ClipEvent :: Press = event {
2345
+ if self . is_editable ( ) || self . is_selectable ( ) {
2346
+ let tracker = context. focus_tracker ;
2347
+ tracker. set ( Some ( self . into ( ) ) , context) ;
2348
+ }
2346
2349
2347
- // We can't hold self as any link may end up modifying this object, so pull the info out
2348
- let mut link_to_open = None ;
2350
+ // We can't hold self as any link may end up modifying this object, so pull the info out
2351
+ let mut link_to_open = None ;
2349
2352
2350
- if let Some ( position) = self . screen_position_to_index ( * context. mouse_position ) {
2351
- self . set_selection ( Some ( TextSelection :: for_position ( position) ) , context. gc ( ) ) ;
2353
+ if let Some ( position) = self . screen_position_to_index ( * context. mouse_position ) {
2354
+ self . set_selection (
2355
+ Some ( TextSelection :: for_position ( position) ) , context. gc ( ) ) ;
2352
2356
2353
- if let Some ( ( span_index, _) ) =
2354
- self . 0 . read ( ) . text_spans . resolve_position_as_span ( position)
2355
- {
2356
- link_to_open = self
2357
- . 0
2358
- . read ( )
2359
- . text_spans
2360
- . span ( span_index)
2361
- . map ( |s| ( s. url . clone ( ) , s. target . clone ( ) ) ) ;
2362
- }
2363
- } else {
2364
- self . set_selection (
2365
- Some ( TextSelection :: for_position ( self . text_length ( ) ) ) ,
2366
- context. gc ( ) ,
2357
+ if let Some ( ( span_index, _) ) =
2358
+ self . 0 . read ( ) . text_spans . resolve_position_as_span ( position)
2359
+ {
2360
+ link_to_open = self
2361
+ . 0
2362
+ . read ( )
2363
+ . text_spans
2364
+ . span ( span_index)
2365
+ . map ( |s| ( s. url . clone ( ) , s. target . clone ( ) ) ) ;
2366
+ }
2367
+ } else {
2368
+ self . set_selection (
2369
+ Some ( TextSelection :: for_position ( self . text_length ( ) ) ) ,
2370
+ context. gc ( ) ,
2367
2371
) ;
2368
2372
}
2369
2373
2370
- if let Some ( ( url, target) ) = link_to_open {
2371
- if !url. is_empty ( ) {
2372
- // TODO: This fires on mouse DOWN but it should be mouse UP...
2373
- // but only if it went down in the same span.
2374
- // Needs more advanced focus handling than we have at time of writing this comment.
2375
- self . open_url ( context, & url, & target) ;
2374
+ if let Some ( ( url, target) ) = link_to_open {
2375
+ if !url. is_empty ( ) {
2376
+ // TODO: This fires on mouse DOWN but it should be mouse UP...
2377
+ // but only if it went down in the same span.
2378
+ // Needs more advanced focus handling than we have at time of writing this comment.
2379
+ self . open_url ( context, & url, & target) ;
2380
+ }
2381
+ }
2382
+
2383
+ return ClipEventResult :: Handled ;
2384
+ }
2385
+
2386
+ if let ClipEvent :: MouseMove = event {
2387
+ // If a mouse has moved and this EditTest is pressed, we need to update the selection.
2388
+ if InteractiveObject :: option_ptr_eq ( context. mouse_data . pressed , self . as_interactive ( ) ) {
2389
+ if let Some ( mut selection) = self . selection ( ) {
2390
+ if let Some ( position) = self . screen_position_to_index ( * context. mouse_position ) {
2391
+ selection. to = position;
2392
+ self . set_selection ( Some ( selection) , context. gc ( ) ) ;
2393
+ }
2394
+ }
2376
2395
}
2377
2396
}
2378
2397
2379
- ClipEventResult :: Handled
2398
+ ClipEventResult :: NotHandled
2380
2399
}
2381
2400
2382
2401
fn mouse_pick_avm1 (
0 commit comments