Merge branch 'master' into preview
This commit is contained in:
Коммит
49c1164cf8
|
@ -3,14 +3,21 @@
|
|||
"lockfileVersion": 1,
|
||||
"dependencies": {
|
||||
"ajv": {
|
||||
"version": "6.10.2",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz",
|
||||
"integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==",
|
||||
"version": "6.12.6",
|
||||
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
||||
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
|
||||
"requires": {
|
||||
"fast-deep-equal": "^2.0.1",
|
||||
"fast-deep-equal": "^3.1.1",
|
||||
"fast-json-stable-stringify": "^2.0.0",
|
||||
"json-schema-traverse": "^0.4.1",
|
||||
"uri-js": "^4.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"fast-deep-equal": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"asn1": {
|
||||
|
@ -99,11 +106,6 @@
|
|||
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
|
||||
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="
|
||||
},
|
||||
"fast-deep-equal": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz",
|
||||
"integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk="
|
||||
},
|
||||
"fast-json-stable-stringify": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
|
||||
|
|
|
@ -411,6 +411,26 @@ namespace Topten.RichTextKit
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Controls the rendering of an ellipsis (`...`) character,
|
||||
/// when the line has been truncated because of MaxWidth/MaxHeight/MaxLines.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default value is true, an ellipsis will be rendered.
|
||||
/// </remarks>
|
||||
public bool EllipsisEnabled
|
||||
{
|
||||
get => _ellipsisEnabled;
|
||||
set
|
||||
{
|
||||
if (value != _ellipsisEnabled)
|
||||
{
|
||||
_ellipsisEnabled = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the default text alignment for cases where
|
||||
/// the rich text doesn't specify an alignment
|
||||
|
@ -738,7 +758,7 @@ namespace Topten.RichTextKit
|
|||
|
||||
ParagraphInfo ParagraphForCodePointIndex(int index)
|
||||
{
|
||||
for (int i=1; i<_paragraphs.Count; i++)
|
||||
for (int i = 1; i < _paragraphs.Count; i++)
|
||||
{
|
||||
if (index < _paragraphs[i].CodePointOffset)
|
||||
return _paragraphs[i - 1];
|
||||
|
@ -775,6 +795,7 @@ namespace Topten.RichTextKit
|
|||
maxWidth = _maxWidth,
|
||||
maxHeight = _maxHeight,
|
||||
maxLines = _maxLines,
|
||||
ellipsisEnabled = _ellipsisEnabled,
|
||||
textAlignment = _textAlignment,
|
||||
baseDirection = _baseDirection,
|
||||
styleManager = StyleManager.Default.Value,
|
||||
|
@ -830,6 +851,7 @@ namespace Topten.RichTextKit
|
|||
public float? maxWidth;
|
||||
public float? maxHeight;
|
||||
public int? maxLines;
|
||||
public bool ellipsisEnabled;
|
||||
public TextAlignment? textAlignment;
|
||||
public TextDirection? baseDirection;
|
||||
public StyleManager styleManager;
|
||||
|
@ -857,6 +879,7 @@ namespace Topten.RichTextKit
|
|||
float? _maxWidth;
|
||||
float? _maxHeight;
|
||||
int? _maxLines;
|
||||
bool _ellipsisEnabled = true;
|
||||
TextAlignment _textAlignment;
|
||||
TextDirection _baseDirection;
|
||||
IStyle _baseStyle;
|
||||
|
@ -974,7 +997,7 @@ namespace Topten.RichTextKit
|
|||
i.Build(buildContext);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Store code point offset of this paragraph
|
||||
CodePointOffset = ctx.TotalLength;
|
||||
LineOffset = ctx.lineCount;
|
||||
|
@ -1019,9 +1042,13 @@ namespace Topten.RichTextKit
|
|||
TextBlock.MaxLines = null;
|
||||
}
|
||||
|
||||
// Set ellipsis option
|
||||
TextBlock.EllipsisEnabled = ctx.ellipsisEnabled;
|
||||
|
||||
// Truncated?
|
||||
if (TextBlock.MaxLines == 0 || TextBlock.MaxHeight == 0)
|
||||
{
|
||||
ctx.previousParagraph?.TextBlock.AddEllipsis();
|
||||
TextBlock = null;
|
||||
Truncated = true;
|
||||
ctx.Truncated = true;
|
||||
|
|
|
@ -128,6 +128,26 @@ namespace Topten.RichTextKit
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Controls the rendering of an ellipsis (`...`) character,
|
||||
/// when the line has been truncated because of MaxWidth/MaxHeight/MaxLines.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The default value is true, an ellipsis will be rendered.
|
||||
/// </remarks>
|
||||
public bool EllipsisEnabled
|
||||
{
|
||||
get => _ellipsisEnabled;
|
||||
set
|
||||
{
|
||||
if (value != _ellipsisEnabled)
|
||||
{
|
||||
_ellipsisEnabled = value;
|
||||
InvalidateLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the left, right or center alignment of the text block.
|
||||
/// </summary>
|
||||
|
@ -234,6 +254,9 @@ namespace Topten.RichTextKit
|
|||
/// </remarks>
|
||||
public void AddEllipsis()
|
||||
{
|
||||
if (!_ellipsisEnabled)
|
||||
return;
|
||||
|
||||
// Make sure laid out
|
||||
Layout();
|
||||
|
||||
|
@ -951,6 +974,11 @@ namespace Topten.RichTextKit
|
|||
/// </summary>
|
||||
int _maxLinesResolved = int.MaxValue;
|
||||
|
||||
/// <summary>
|
||||
/// Option to control ellipsis
|
||||
/// </summary>
|
||||
bool _ellipsisEnabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// Text alignment
|
||||
/// </summary>
|
||||
|
@ -1888,6 +1916,9 @@ namespace Topten.RichTextKit
|
|||
/// <param name="postLayout">True if the ellipsis is being added post layout via a user call to AddEllipsis()</param>
|
||||
void AdornLineWithEllipsis(TextLine line, bool postLayout = false)
|
||||
{
|
||||
if (!_ellipsisEnabled)
|
||||
return;
|
||||
|
||||
var lastRun = line.Runs[line.Runs.Count - 1];
|
||||
|
||||
// Don't add ellipsis if the last run actually
|
||||
|
|
Загрузка…
Ссылка в новой задаче