mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-06 08:22:23 +00:00
Simplify naming.
This commit is contained in:
@@ -24,8 +24,8 @@ class Brush {
|
|||||||
private BrushType mType = BrushType.LINEAR_GRADIENT;
|
private BrushType mType = BrushType.LINEAR_GRADIENT;
|
||||||
private final ReadableArray mPoints;
|
private final ReadableArray mPoints;
|
||||||
private ReadableArray mColors;
|
private ReadableArray mColors;
|
||||||
private Matrix mMatrix;
|
|
||||||
private final boolean mUseObjectBoundingBox;
|
private final boolean mUseObjectBoundingBox;
|
||||||
|
private Matrix mMatrix;
|
||||||
private Rect mUserSpaceBoundingBox;
|
private Rect mUserSpaceBoundingBox;
|
||||||
|
|
||||||
Brush(BrushType type, ReadableArray points, BrushUnits units) {
|
Brush(BrushType type, ReadableArray points, BrushUnits units) {
|
||||||
|
|||||||
@@ -123,16 +123,16 @@ class GlyphContext {
|
|||||||
if (positionX != null) {
|
if (positionX != null) {
|
||||||
mXPositionsIndex++;
|
mXPositionsIndex++;
|
||||||
mXPositionIndex = -1;
|
mXPositionIndex = -1;
|
||||||
mXs = positionX.trim().split("\\s+");
|
|
||||||
mXPositionIndices.add(mXPositionIndex);
|
mXPositionIndices.add(mXPositionIndex);
|
||||||
|
mXs = positionX.trim().split("\\s+");
|
||||||
mXPositionsContext.add(mXs);
|
mXPositionsContext.add(mXs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (positionY != null) {
|
if (positionY != null) {
|
||||||
mYPositionsIndex++;
|
mYPositionsIndex++;
|
||||||
mYPositionIndex = -1;
|
mYPositionIndex = -1;
|
||||||
mYs = positionY.trim().split("\\s+");
|
|
||||||
mYPositionIndices.add(mYPositionIndex);
|
mYPositionIndices.add(mYPositionIndex);
|
||||||
|
mYs = positionY.trim().split("\\s+");
|
||||||
mYPositionsContext.add(mYs);
|
mYPositionsContext.add(mYs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,34 +239,30 @@ class GlyphContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PointF getNextGlyphPoint(float glyphWidth) {
|
PointF nextPoint(float glyphWidth) {
|
||||||
setGlyphPositionX();
|
nextPositionX();
|
||||||
setGlyphPositionY();
|
nextPositionY();
|
||||||
mCurrentPosition.x += glyphWidth;
|
mCurrentPosition.x += glyphWidth;
|
||||||
return mCurrentPosition;
|
return mCurrentPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
PointF getNextGlyphDelta() {
|
PointF nextDelta() {
|
||||||
setNextDeltaX();
|
nextDeltaX();
|
||||||
setNextDeltaY();
|
nextDeltaY();
|
||||||
return mCurrentDelta;
|
return mCurrentDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
float getNextGlyphRotation() {
|
float nextRotation() {
|
||||||
setNextGlyphRotation();
|
|
||||||
return mRotations[mRotationIndex];
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setNextGlyphRotation() {
|
|
||||||
for (int index = mRotationsIndex; index >= 0; index--) {
|
for (int index = mRotationsIndex; index >= 0; index--) {
|
||||||
int rotationIndex = mRotationIndices.get(index);
|
int rotationIndex = mRotationIndices.get(index);
|
||||||
mRotationIndices.set(index, rotationIndex + 1);
|
mRotationIndices.set(index, rotationIndex + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
mRotationIndex = Math.min(mRotationIndex + 1, mRotations.length - 1);
|
mRotationIndex = Math.min(mRotationIndex + 1, mRotations.length - 1);
|
||||||
|
return mRotations[mRotationIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNextDeltaX() {
|
private void nextDeltaX() {
|
||||||
for (int index = mDeltaXsIndex; index >= 0; index--) {
|
for (int index = mDeltaXsIndex; index >= 0; index--) {
|
||||||
int deltaIndex = mDeltaXIndices.get(index);
|
int deltaIndex = mDeltaXIndices.get(index);
|
||||||
mDeltaXIndices.set(index, deltaIndex + 1);
|
mDeltaXIndices.set(index, deltaIndex + 1);
|
||||||
@@ -280,7 +276,7 @@ class GlyphContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNextDeltaY() {
|
private void nextDeltaY() {
|
||||||
for (int index = mDeltaYsIndex; index >= 0; index--) {
|
for (int index = mDeltaYsIndex; index >= 0; index--) {
|
||||||
int deltaIndex = mDeltaYIndices.get(index);
|
int deltaIndex = mDeltaYIndices.get(index);
|
||||||
mDeltaYIndices.set(index, deltaIndex + 1);
|
mDeltaYIndices.set(index, deltaIndex + 1);
|
||||||
@@ -294,7 +290,7 @@ class GlyphContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setGlyphPositionX() {
|
private void nextPositionX() {
|
||||||
for (int index = mXPositionsIndex; index >= 0; index--) {
|
for (int index = mXPositionsIndex; index >= 0; index--) {
|
||||||
int positionIndex = mXPositionIndices.get(index);
|
int positionIndex = mXPositionIndices.get(index);
|
||||||
mXPositionIndices.set(index, positionIndex + 1);
|
mXPositionIndices.set(index, positionIndex + 1);
|
||||||
@@ -309,7 +305,7 @@ class GlyphContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setGlyphPositionY() {
|
private void nextPositionY() {
|
||||||
for (int index = mYPositionsIndex; index >= 0; index--) {
|
for (int index = mYPositionsIndex; index >= 0; index--) {
|
||||||
int positionIndex = mYPositionIndices.get(index);
|
int positionIndex = mYPositionIndices.get(index);
|
||||||
mYPositionIndices.set(index, positionIndex + 1);
|
mYPositionIndices.set(index, positionIndex + 1);
|
||||||
@@ -348,7 +344,7 @@ class GlyphContext {
|
|||||||
return DEFAULT_FONT_SIZE;
|
return DEFAULT_FONT_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReadableMap getGlyphFont() {
|
ReadableMap getFont() {
|
||||||
float letterSpacing = DEFAULT_LETTER_SPACING;
|
float letterSpacing = DEFAULT_LETTER_SPACING;
|
||||||
float kerning = DEFAULT_KERNING;
|
float kerning = DEFAULT_KERNING;
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ class TSpanShadowNode extends TextShadowNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GlyphContext gc = getTextRootGlyphContext();
|
GlyphContext gc = getTextRootGlyphContext();
|
||||||
ReadableMap font = gc.getGlyphFont();
|
ReadableMap font = gc.getFont();
|
||||||
applyTextPropertiesToPaint(paint, font);
|
applyTextPropertiesToPaint(paint, font);
|
||||||
|
|
||||||
float distance = 0;
|
float distance = 0;
|
||||||
@@ -160,9 +160,9 @@ class TSpanShadowNode extends TextShadowNode {
|
|||||||
previous = current;
|
previous = current;
|
||||||
}
|
}
|
||||||
|
|
||||||
point = gc.getNextGlyphPoint(width + kerning);
|
point = gc.nextPoint(width + kerning);
|
||||||
rotation = gc.getNextGlyphRotation();
|
rotation = gc.nextRotation();
|
||||||
delta = gc.getNextGlyphDelta();
|
delta = gc.nextDelta();
|
||||||
matrix = new Matrix();
|
matrix = new Matrix();
|
||||||
|
|
||||||
float x = offset + point.x + delta.x - width;
|
float x = offset + point.x + delta.x - width;
|
||||||
|
|||||||
Reference in New Issue
Block a user