brown.core.horizontal_spanner

classes

permalink view source

HorizontalSpanner (Spanner)

A spanner which is perfectly horizontal.

When in a Flowable, this spanner's end_y position always maps to the same y-axis position as its starting position in the Flowable's local space.

Otherwise, this spanner's end_y position always maps to the same y-axis position as its starting position in document space.

Like its Spanner superclass, this class is a mixin meant to be combined with GraphicObjects. Because the horizontal guarantees given by this spanner depend on the position of the GraphicObject starting position, it is crucial that, when initializing in implementation __init__ methods, this be initialized after the GraphicObject exists and has its intended pos and parent properties set.

This differs from a typical spanner in that neither its end_y or end_pos attributes are settable. Only the end_x or end_parent properties may be modified.

__init__ (end_x, end_parent=None) permalink view source

overriden from Spanner

arguments:

end_x (Unit): The x-axis position of the endpoint

end_parent (GraphicObject or None): The parent of the endpoint. end_pos will be relative to this object. If None, this defaults to the spanner.

properties

end_x: Unit The x position of the endpoint permalink view source

overriden from Spanner

end_y: Unit The y position of the endpoint. permalink view source

overriden from Spanner

Unlike that in Spanner, this property is read-only in order to maintain its horizontal guarantees.

read-only.

end_pos: Point The position of the endpoint permalink view source

overriden from Spanner

read-only.

inherited properties

end_parent: GraphicObject The parent of the endpoint. permalink view source

self.end_pos is measured relative to this. To make self.end_pos relative to self.pos, simply set this to self.

inherited from Spanner

spanner_x_length: Unit The x-axis length of the spanner. permalink view source

Implementing subclasses will often want to override GraphicObject.length to return this.

read-only.

inherited from Spanner

spanner_length: Unit The 2d length of the spanner. permalink view source

Note: This takes into account both the x and y axis. For only the horizontal length, use spanner_x_length.

read-only.

inherited from Spanner