add text lineSpacing

This commit is contained in:
pengfei.zhou 2020-03-24 16:23:51 +08:00 committed by osborn
parent e46f09427b
commit 90e494222d
8 changed files with 24 additions and 32 deletions

View File

@ -1,4 +1,4 @@
import { Panel, Group, scroller, vlayout, layoutConfig, LayoutSpec, Input, Gravity, log, input, text, Color } from "doric"; import { Panel, Group, scroller, vlayout, layoutConfig, LayoutSpec, Input, Gravity, log, input, text, Color, Text } from "doric";
import { title } from "./utils"; import { title } from "./utils";
@Entry @Entry
class TextDemo extends Panel { class TextDemo extends Panel {
@ -64,6 +64,10 @@ class TextDemo extends Panel {
lineSpacing: 40, lineSpacing: 40,
textColor: Color.RED, textColor: Color.RED,
textAlignment: Gravity.Right, textAlignment: Gravity.Right,
onClick: function () {
(this as Text).textAlignment = Gravity.Left;
(this as Text).textColor = Color.BLACK;
}
}), }),
], ],
{ {

View File

@ -88,6 +88,9 @@ - (void)blendView:(UILabel *)view forPropName:(NSString *)name propValue:(id)pro
} }
if (self.paragraphStyle) { if (self.paragraphStyle) {
self.paragraphStyle.alignment = alignment; self.paragraphStyle.alignment = alignment;
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:view.text];
[attributedString addAttribute:NSParagraphStyleAttributeName value:self.paragraphStyle range:NSMakeRange(0, [attributedString length])];
view.attributedText = attributedString;
} else { } else {
view.textAlignment = alignment; view.textAlignment = alignment;
} }

View File

@ -1823,12 +1823,9 @@ var List = /** @class */ (function (_super) {
this.itemCount = 0; this.itemCount = 0;
}; };
List.prototype.getItem = function (itemIdx) { List.prototype.getItem = function (itemIdx) {
var view = this.cachedViews.get("" + itemIdx); var view = this.renderItem(itemIdx);
if (view === undefined) {
view = this.renderItem(itemIdx);
view.superview = this; view.superview = this;
this.cachedViews.set("" + itemIdx, view); this.cachedViews.set("" + itemIdx, view);
}
return view; return view;
}; };
List.prototype.isDirty = function () { List.prototype.isDirty = function () {

View File

@ -1345,12 +1345,9 @@ class List extends Superview {
this.itemCount = 0; this.itemCount = 0;
} }
getItem(itemIdx) { getItem(itemIdx) {
let view = this.cachedViews.get(`${itemIdx}`); let view = this.renderItem(itemIdx);
if (view === undefined) {
view = this.renderItem(itemIdx);
view.superview = this; view.superview = this;
this.cachedViews.set(`${itemIdx}`, view); this.cachedViews.set(`${itemIdx}`, view);
}
return view; return view;
} }
isDirty() { isDirty() {

View File

@ -2804,12 +2804,9 @@ class List extends Superview {
this.itemCount = 0; this.itemCount = 0;
} }
getItem(itemIdx) { getItem(itemIdx) {
let view = this.cachedViews.get(`${itemIdx}`); let view = this.renderItem(itemIdx);
if (view === undefined) {
view = this.renderItem(itemIdx);
view.superview = this; view.superview = this;
this.cachedViews.set(`${itemIdx}`, view); this.cachedViews.set(`${itemIdx}`, view);
}
return view; return view;
} }
isDirty() { isDirty() {

View File

@ -52,12 +52,9 @@ export class List extends Superview {
this.itemCount = 0; this.itemCount = 0;
} }
getItem(itemIdx) { getItem(itemIdx) {
let view = this.cachedViews.get(`${itemIdx}`); let view = this.renderItem(itemIdx);
if (view === undefined) {
view = this.renderItem(itemIdx);
view.superview = this; view.superview = this;
this.cachedViews.set(`${itemIdx}`, view); this.cachedViews.set(`${itemIdx}`, view);
}
return view; return view;
} }
isDirty() { isDirty() {

View File

@ -2862,12 +2862,9 @@ class List extends Superview {
this.itemCount = 0; this.itemCount = 0;
} }
getItem(itemIdx) { getItem(itemIdx) {
let view = this.cachedViews.get(`${itemIdx}`); let view = this.renderItem(itemIdx);
if (view === undefined) {
view = this.renderItem(itemIdx);
view.superview = this; view.superview = this;
this.cachedViews.set(`${itemIdx}`, view); this.cachedViews.set(`${itemIdx}`, view);
}
return view; return view;
} }
isDirty() { isDirty() {

File diff suppressed because one or more lines are too long