Commit Graph

99 Commits

Author SHA1 Message Date
Mikael Sand
fc63635f3c Implement basic support for Pattern element 2018-09-02 16:06:44 +03:00
Mikael Sand
a1097b8594 Fix spec conformance of clipping path with multiple child elements.
https://www.w3.org/TR/SVG11/masking.html#EstablishingANewClippingPath

The raw geometry of each child element exclusive of rendering properties such as ‘fill’, ‘stroke’, ‘stroke-width’ within a ‘clipPath’ conceptually defines a 1-bit mask (with the possible exception of anti-aliasing along the edge of the geometry) which represents the silhouette of the graphics associated with that element. Anything outside the outline of the object is masked out. If a child element is made invisible by ‘display’ or ‘visibility’ it does not contribute to the clipping path. When the ‘clipPath’ element contains multiple child elements, the silhouettes of the child elements are logically OR'd together to create a single silhouette which is then used to restrict the region onto which paint can be applied. Thus, a point is inside the clipping path if it is inside any of the children of the ‘clipPath’.

For a given graphics element, the actual clipping path used will be the intersection of the clipping path specified by its ‘clip-path’ property (if any) with any clipping paths on its ancestors, as specified by the ‘clip-path’ property on the ancestor elements, or by the ‘overflow’ property on ancestor elements which establish a new viewport. Also, see the discussion of the initial clipping path.)

Fixes issues highlighted by https://github.com/react-native-community/react-native-svg/issues/752
Fix https://github.com/react-native-community/react-native-svg/issues/280
Fix https://github.com/react-native-community/react-native-svg/issues/517

[android] Fix https://github.com/react-native-community/react-native-svg/issues/766
`Region.Op.REPLACE` is deprecated in API level 28
Replace with clipPath (Path path) to Intersect instead.
2018-09-01 02:55:36 +03:00
Mikael Sand
f1f0e2f186 [ios] Fix clipping of images 2018-08-25 12:36:48 +03:00
Mikael Sand
e98b0fe1d1 Merge branch 'master' into NativeAnimation
# Conflicts:
#	android/src/main/java/com/horcrux/svg/RenderableShadowNode.java
#	android/src/main/java/com/horcrux/svg/SvgViewShadowNode.java
#	elements/Image.js
#	elements/Rect.js
#	elements/Use.js
#	lib/attributes.js
2018-08-19 15:48:40 +03:00
Mikael Sand
eafe5d4f7c [ios] Fix crash on nested svg 2018-07-02 05:25:20 +03:00
Maksym Komarychev
4fc6f4fd87 [ios] fire onLayout 2018-06-09 00:20:27 +03:00
Maksym Komarychev
2d698e92d5 [ios] Handle touches within use 2018-04-14 19:38:11 +03:00
Maksym Komarychev
de01bb8638 [ios] Fix touch handling in groups
Check all children before current node itself.
Add shortcut check to return active node if `event` is null. Otherwise
it may return wrong node which have higher z-index value.
2018-04-14 19:36:48 +03:00
Bilal Syed
ca92b72944 Set _imageSize on load 2018-03-19 13:51:13 +03:00
Mikael Sand
57e458c328 Fix missing rect parameter 2018-03-19 01:11:33 +02:00
Mikael Sand
13fcdf6f15 Merge remote-tracking branch 'msand/NestedSvg' into merge-test
# Conflicts:
#	ios/Elements/RNSVGGroup.m
#	ios/RNSVGNode.h
#	ios/RNSVGNode.m
2018-03-19 00:27:01 +02:00
Mikael Sand
6b0ff5e19f Fix merge issue. 2018-03-18 23:32:04 +02:00
Mikael Sand
e334c74c7c Merge branch 'fix-display-none' into bugfix/278-memory-leak-issue 2018-03-18 23:17:56 +02:00
Mikael Sand
40a17c838d Merge remote-tracking branch 'uxbert/5.5.1-load-image-from-url' into fix-display-none
# Conflicts:
#	android/src/main/java/com/horcrux/svg/ImageShadowNode.java
#	ios/Elements/RNSVGImage.m
2018-03-18 23:14:29 +02:00
Mikael Sand
0eb501d5e8 Alternative approach without TextureView. 2018-03-18 22:39:44 +02:00
Mikael Sand
7deabf8287 Add RenderableView, fix names. Allow percentages in nested SVG (iOS). 2018-03-17 23:22:40 +02:00
Bilal Syed
77ebefb650 Load Image from URL 2018-03-15 19:00:58 +03:00
James Reggio
ca9855b1cd Fix issue where Svg never draws if mounted while parent is hidden (iOS only) 2018-03-15 11:17:27 -04:00
Nikolay Demyankov
ef8b687ff0 Fix retain cycle for the textRoot property. 2018-03-14 15:31:02 +01:00
Nikolay Demyankov
26964598fc Fix retain cycle for nested views. 2018-03-14 11:05:20 +01:00
Mikael Sand
8ff052ce40 Optimize group hitTest 2018-02-23 01:38:41 +02:00
Mikael Sand
cd43fc151e Optimize hit testing. 2018-02-23 00:19:10 +02:00
Mikael Sand
b5eeb1ee72 Allow nesting React-Native View components inside svg 2018-02-21 12:17:12 +02:00
Mikael Sand
ee1d1f78cc First attempt at nested svg support. 2018-02-21 12:17:12 +02:00
Ben Roth
b217dcaff8 Prefix iOS symbols with RNSVG
fixes https://github.com/react-native-community/react-native-svg/issues/603
2018-02-14 19:04:32 -08:00
Mikael Sand
310fbed841 Fix image rendering 2018-01-03 20:30:36 +02:00
Mikael Sand
f07e8f041c Allow TextPath to reference any RNSVGNode instead of only RNSVGPath.
Remove unused RNSVGTextAnchor
2017-12-30 03:35:58 +02:00
Mikael Sand
7088d52b71 Refactor and simplify, cache path properties.
Remove use of UIBezierPath and categories.
2017-12-29 23:04:24 +02:00
Mikael Sand
ec2a967592 Implement getAlignmentBaseline and getBaselineShift in ios. (#527)
* Implement correct transform parser

* Implement getAlignmentBaseline and getBaselineShift in ios.
Add comments to glyphcontext and align with android.
Implement correct isWordSeparator predicate.
Cleanup GlyphContext j2objc remnants.

* Fix getBaselineShift bugs and font data invalidation.
2017-12-16 08:57:53 -08:00
Horcrux
7474c90957 Fix image render 2017-11-08 12:25:39 +08:00
Horcrux
75786787e9 Fix Image in iOS 2017-11-08 01:34:53 +08:00
Horcrux
5b2972f8f6 Fix Symbol position 2017-11-08 01:14:45 +08:00
Mikael Sand
04887af278 Implement kerning, ligatures, etc., and cleanup; in ios.
Implement hasGlyph ligature helper.

Export view property setters for:
 text: textLength, baselineShift, lengthAdjust, alignmentBaseline,
 textPath: side, method, midLine, spacing.

Attempt to fix alignmentBaseline and baselineShift,
but both properties are nil at all times, I must be missing something.
2017-08-29 02:34:56 +03:00
Mikael Sand
13d5157fc1 Cleanup. 2017-08-23 16:22:49 +03:00
Mikael Sand
ccb8729917 Port new GlyphContext, FontData, enums, props, Bezier and text rendering 2017-08-23 05:41:35 +03:00
Mikael Sand
3cafc34cb2 Fix ViewBox, images, transforms, and, gradients; on ios.
Make getContextWidth/Height and setupGlyphContext take clip bounding box and affine transform matrix into consideration.
2017-08-16 19:06:23 +03:00
Mikael Sand
f1657d9ddf Prepare for new GlyphContext. 2017-08-15 19:50:50 +03:00
Horcrux
9df76e5668 Use Image.propTypes.source as href propType 2017-04-04 10:45:54 +08:00
Horcrux
cad8d8902b Merge pull request #216 from gpminsuk/master
Data URI support for href in react-native-svg Image tag
2017-04-04 10:41:35 +08:00
Horcrux
c91d333950 saveDefinition => parseReference 2017-02-04 11:18:10 +08:00
Horcrux
cfaca8b3cb Add gradientUnits support 2017-01-24 22:24:36 +08:00
Horcrux
42c626dbfb Fix G renderable props 2017-01-22 23:10:23 +08:00
Horcrux
777b3532ce Fix touchEvents with viewBox prop on SVG 2017-01-22 20:39:42 +08:00
Horcrux
1db96aaa07 Fix warnings 2017-01-22 19:45:50 +08:00
Horcrux
8cd78e830e Finish Symbol refactor on Android 2017-01-22 17:57:07 +08:00
Horcrux
1b04e11ca4 Refactor Symbol on iOS 2017-01-22 17:51:47 +08:00
Horcrux
af6db7039f Finish percentage props refactor on iOS 2017-01-20 17:47:57 +08:00
Horcrux
7c9f6b2d3d Remove unused public method 2017-01-16 14:38:43 +08:00
Horcrux
dcc39c4b67 Fix memory leaks 2017-01-11 19:31:42 +08:00
Horcrux
6e81ecf147 Fix touch events on Text elements 2017-01-11 18:55:42 +08:00