Skip to content
Permalink
Browse files

ScrollV fixes (#2257)

* ScrollV fixes
WIP first commit

* Cleanup
  • Loading branch information
MSGhero committed Sep 15, 2019
1 parent e70564f commit 412aac7057bae619d6aa56a75460e815d04aa7e4
Showing with 15 additions and 17 deletions.
  1. +10 −14 src/openfl/_internal/text/TextEngine.hx
  2. +5 −3 src/openfl/text/TextField.hx
@@ -1784,23 +1784,21 @@ class TextEngine
else
{
var tempHeight = 0.0;
var ret = lineHeights.length;
var ret = scrollV;

for (i in ret - 1...lineHeights.length)
{
if (tempHeight + lineHeights[i] <= height - GUTTER * 2)
while (ret <= lineHeights.length) {
if (tempHeight + lineHeights[ret - 1] <= height - GUTTER * 2)
{
tempHeight += lineHeights[i];
}
else
{
ret = i;
break;
tempHeight += lineHeights[ret - 1];
}

else break;

ret++;
}

if (ret < 1) return 1;
return ret;
return ret - 1;
}
}

@@ -1814,8 +1812,6 @@ class TextEngine
else
{
var i = numLines - 1, tempHeight = 0.0;

if (text.charCodeAt(text.length - 1) == '\n'.code) i--; // trailing newlines do not contribute to maxScrollV
var j = i;

while (i >= 0)
@@ -2844,10 +2844,11 @@ class TextField extends InteractiveObject
{
__dirty = true;
__setRenderDirty();
__textEngine.scrollH = value;
dispatchEvent(new Event(Event.SCROLL));
}

return __textEngine.scrollH = value;
return __textEngine.scrollH;
}

@:noCompletion private function get_scrollV():Int
@@ -2859,14 +2860,15 @@ class TextField extends InteractiveObject
{
__updateLayout();

if (value != __textEngine.scrollV)
if (value > 0 && value != __textEngine.scrollV)
{
__dirty = true;
__setRenderDirty();
__textEngine.scrollV = value;
dispatchEvent(new Event(Event.SCROLL));
}

return __textEngine.scrollV = value;
return __textEngine.scrollV;
}

@:noCompletion private function get_selectable():Bool

0 comments on commit 412aac7

Please sign in to comment.
You can’t perform that action at this time.