Closed WilliamHYZhang closed 4 years ago
Oooof. PR build is failing... I'll look into it.
Fixed, @karwa when this is merged may you rerun quartz tests when you have time? No hurry.
@KarthikRIyer resolved merge conflicts
@KarthikRIyer should be good to go.
Looks good @WilliamHYZhang. Good job!
Introducing the newest feature for annotations, the ability to anchor them to anything! This idea started as just to anchor text annotations, but with the help of some nifty tricks we can expand this significantly. Here's an overview of what I did in this PR:
enum
,Direction
. This is where we specify the north/east/south/west direction that we would like to anchor to.Anchor
. This extendsAnnotation
to include a direction and a float buffer (space desired between the annotation and the anchor point). We also require aresolve
function that will deal with the anchor directions and update the parameters of the annotation accordingly.Box
andText
annotations also conform toAnchor
. Now, we could just replace this with just conforming toAnchor
as it extendsAnnotation
, however I think that this definition is more verbose.Arrow
annotation to support anchoring of any annotation that supports it. Also included an option to override the anchor and force to draw at passed coordinates if the user desires.So what does this mean for the future of annotations in SwiftPlot?
Anchor
and we're good to go.resolve
function and it will relocate itself. We can make it anchored to the origin, ends of lines in line graphs, etc... the list is endless.Anyways, hope you guys like it. I'm definitely open to any suggestions for improvements or new ideas. Feel free to check it out.
William