mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-04 07:25:53 +00:00
[android] Support other elements than Path as href in TextPath
This commit is contained in:
@@ -102,7 +102,7 @@ class TSpanShadowNode extends TextShadowNode {
|
||||
boolean isClosed = false;
|
||||
final boolean hasTextPath = textPath != null;
|
||||
if (hasTextPath) {
|
||||
pm = new PathMeasure(textPath.getPath(), false);
|
||||
pm = new PathMeasure(textPath.getTextPath(canvas, paint), false);
|
||||
pathLength = pm.getLength();
|
||||
isClosed = pm.isClosed();
|
||||
if (pathLength == 0) {
|
||||
|
||||
@@ -987,7 +987,7 @@ public class TextLayoutAlgorithm {
|
||||
*/
|
||||
final TextPathShadowNode textPathShadowNode = inTextPath.get(index);
|
||||
if (textPathShadowNode != null && result[index].addressable) {
|
||||
textPath = textPathShadowNode.getPath();
|
||||
textPath = textPathShadowNode.getTextPath(null, null);
|
||||
inPath = true;
|
||||
/*
|
||||
|
||||
|
||||
@@ -92,17 +92,17 @@ class TextPathShadowNode extends TextShadowNode {
|
||||
drawGroup(canvas, paint, opacity);
|
||||
}
|
||||
|
||||
public Path getPath() {
|
||||
public Path getTextPath(Canvas canvas, Paint paint) {
|
||||
SvgViewShadowNode svg = getSvgShadowNode();
|
||||
VirtualNode template = svg.getDefinedTemplate(mHref);
|
||||
|
||||
if (template == null || template.getClass() != PathShadowNode.class) {
|
||||
if (template == null || !(template instanceof RenderableShadowNode)) {
|
||||
// warning about this.
|
||||
return null;
|
||||
}
|
||||
|
||||
PathShadowNode path = (PathShadowNode)template;
|
||||
return path.getPath();
|
||||
RenderableShadowNode shadowNode = (RenderableShadowNode)template;
|
||||
return shadowNode.getPath(canvas, paint);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user