mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-04 15:44:24 +00:00
Cache textRoot for getTextRootGlyphContext.
Use getTextRootGlyphContext() instead of getTextRoot().getGlyphContext() in TextShadowNode.pushGlyphContext()
This commit is contained in:
@@ -29,6 +29,7 @@ class GroupShadowNode extends RenderableShadowNode {
|
|||||||
@Nullable ReadableMap mFont;
|
@Nullable ReadableMap mFont;
|
||||||
|
|
||||||
private GlyphContext mGlyphContext;
|
private GlyphContext mGlyphContext;
|
||||||
|
private GroupShadowNode textRoot;
|
||||||
|
|
||||||
@ReactProp(name = "font")
|
@ReactProp(name = "font")
|
||||||
public void setFont(@Nullable ReadableMap font) {
|
public void setFont(@Nullable ReadableMap font) {
|
||||||
@@ -47,7 +48,10 @@ class GroupShadowNode extends RenderableShadowNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GlyphContext getTextRootGlyphContext() {
|
GlyphContext getTextRootGlyphContext() {
|
||||||
return getTextRoot().getGlyphContext();
|
if (textRoot == null) {
|
||||||
|
textRoot = getTextRoot();
|
||||||
|
}
|
||||||
|
return textRoot.getGlyphContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
void pushGlyphContext() {
|
void pushGlyphContext() {
|
||||||
|
|||||||
@@ -178,6 +178,6 @@ class TextShadowNode extends GroupShadowNode {
|
|||||||
@Override
|
@Override
|
||||||
void pushGlyphContext() {
|
void pushGlyphContext() {
|
||||||
boolean isTextNode = !(this instanceof TextPathShadowNode) && !(this instanceof TSpanShadowNode);
|
boolean isTextNode = !(this instanceof TextPathShadowNode) && !(this instanceof TSpanShadowNode);
|
||||||
getTextRoot().getGlyphContext().pushContext(this, mFont, mRotate, mDeltaX, mDeltaY, mPositionX, mPositionY, isTextNode);
|
getTextRootGlyphContext().pushContext(this, mFont, mRotate, mDeltaX, mDeltaY, mPositionX, mPositionY, isTextNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user