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