Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flash.text.Textfield selected scrolls down, last line doesn't displayed in some case #3264

Open
pol2095 opened this issue May 23, 2024 · 3 comments
Labels

Comments

@pol2095
Copy link

pol2095 commented May 23, 2024

Problem Description

when I select the text and move the mouse down, the last line is selected but not visible (flash.text.Textfield doesn't scroll to see the last line) if the mouse is positioned on the right of the textfield.

  • all AIR SDK
  • Windows and macOS
  • all users are affected

Steps to Reproduce

when I select the text and move the mouse down, the last line is selected but not visible (flash.text.Textfield doesn't scroll to see the last line) if the mouse is positioned on the right of the textfield.

package
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	
	public class Main extends Sprite
	{
		public function Main()
		{
			this.addEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
		}
		
		private function addedToStageHandler(e:Event):void
		{
			this.removeEventListener(Event.ADDED_TO_STAGE, addedToStageHandler);
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			
			var textField:TextField = new TextField();
			textField.background = true;
			textField.border = true;
			textField.type = "input";
			textField.wordWrap = true;
			textField.multiline = true;
			textField.y = 40;
			textField.width = 300;
			
			textField.text = "ActionScript provides several ways to format your text at runtime. The TextFormat class lets you set character and paragraph formatting for TextField objects. You can apply Cascading Style Sheets (CSS) styles to text fields by using the TextField.styleSheet property and the StyleSheet class. You can use CSS to style built-in HTML tags, define new formatting tags, or apply styles. You can assign HTML formatted text, which optionally uses CSS styles, directly to a text field. HTML text that you assign to a text field can contain embedded media (movie clips, SWF files, GIF files, PNG files, and JPEG files).";
			this.addChild(textField);
		}
	}
}

Actual result :
Sans titre

Expected result :
Sans titre2

Known Workarounds

No workaround

@pol2095 pol2095 added the Bug label May 23, 2024
@pol2095 pol2095 changed the title flash.text.Textfield selected scroll down, last line doesn't displayed in some case flash.text.Textfield selected scrolls down, last line doesn't displayed in some case May 23, 2024
@ylazy
Copy link

ylazy commented May 24, 2024

I can't reproduce your problem on my machine (Windows 11, AIR 32/51), the text is displayed fully including the last sentence:

image

if the mouse is positioned on the right of the textfield.

I don't understand this. I think you should make a screen record to show your actions.

@ajwfrost
Copy link
Collaborator

It depends a bit how the text is wrapped. If you add a few more words so that the final sentence only goes a little in to the line, but the mouse is to the right of this, then it won't display the final line. But if you move your mouse to the left so that it's vertically underneath where the full stop should be, then the final scroll happens.

Seems to be related to the fact that the selections don't actually go to the end of the line (or the start, if you're moving your mouse above the text field), although this particular behaviour does then match notepad (and HTML/Edge, just looking at this editor itself...)

But a fairly easy fix, there are some conditions about the scroll amount vs selection position, but ultimately if you're dragging downwards on a text field, it should always scroll.

FYI we also found that the auto-scroll doesn't properly select the text if you hold the mouse still. So e.g. start a selection at the top of the text field, quickly move your mouse down to below the text field and then stop it moving, the text field should scroll down line by line with the selection expanding to match... but although the scrolling works, the selection doesn't.

Interesting, these problems seem to have been in the TextField control for many many years..?!

thanks

@pol2095
Copy link
Author

pol2095 commented May 25, 2024

I tried spark.components.TextArea using TLF, it doesn't have this behaviors, but mx.controls.TextArea using flash.text.TextField have the same behaviors.

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http:https://ns.adobe.com/mxml/2009"	
	xmlns:s="library:https://ns.adobe.com/flex/spark"
	xmlns:mx="library:https://ns.adobe.com/flex/mx"
	addedToStage="ats(event)">

	<fx:Script>
		<![CDATA[
			private function ats(event:Event):void
			{
				tlfTextField.text = "ActionScript provides several ways to format your text at runtime. The TextFormat class lets you set character and paragraph formatting for TextField objects. You can apply Cascading Style Sheets (CSS) styles to text fields by using the TextField.styleSheet property and the StyleSheet class. You can use CSS to style built-in HTML tags, define new formatting tags, or apply styles. You can assign HTML formatted text, which optionally uses CSS styles, directly to a text field. HTML text that you assign to a text field can contain embedded media (movie clips, SWF files, GIF files, PNG files, and JPEG files).";
				
				textField.text = "ActionScript provides several ways to format your text at runtime. The TextFormat class lets you set character and paragraph formatting for TextField objects. You can apply Cascading Style Sheets (CSS) styles to text fields by using the TextField.styleSheet property and the StyleSheet class. You can use CSS to style built-in HTML tags, define new formatting tags, or apply styles. You can assign HTML formatted text, which optionally uses CSS styles, directly to a text field. HTML text that you assign to a text field can contain embedded media (movie clips, SWF files, GIF files, PNG files, and JPEG files).";
			}
		]]>
	</fx:Script>

	<s:VGroup>
		<s:TextArea width="300" height="150" id="tlfTextField"/>
		<mx:TextArea width="300" height="150" id="textField"/>
	</s:VGroup>
</s:Application>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants