File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5050- (UIColor *)orderedListMarkerColor ;
5151- (void )setOrderedListMarkerColor : (UIColor *)newValue ;
5252- (UIFont *)orderedListMarkerFont ;
53- - (CGFloat)orderedListMarkerWidth ;
5453- (UIColor *)unorderedListBulletColor ;
5554- (void )setUnorderedListBulletColor : (UIColor *)newValue ;
5655- (CGFloat)unorderedListBulletSize ;
Original file line number Diff line number Diff line change @@ -313,15 +313,6 @@ - (UIFont *)orderedListMarkerFont {
313313 return _orderedListMarkerFont;
314314}
315315
316- - (CGFloat)orderedListMarkerWidth {
317- NSDictionary *markerAttributes = @{
318- NSFontAttributeName : [self primaryFont ],
319- NSForegroundColorAttributeName : [self primaryColor ]
320- };
321- // TODO: marker widths could be dynamic, for now we settle with (usually) the widest 2-digit marker
322- return [@" 88." sizeWithAttributes: markerAttributes].width ;
323- }
324-
325316- (UIColor *)unorderedListBulletColor {
326317 return _unorderedListBulletColor;
327318}
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ + (StyleType)getStyleType { return OrderedList; }
1313
1414- (CGFloat)getHeadIndent {
1515 // lists are drawn manually
16- // margin before marker + marker width + gap between marker and paragraph
17- return [_editor->config orderedListMarginLeft ] + [_editor->config orderedListMarkerWidth ] + [_editor->config orderedListGapWidth ];
16+ // margin before marker + gap between marker and paragraph
17+ return [_editor->config orderedListMarginLeft ] + [_editor->config orderedListGapWidth ];
1818}
1919
2020- (instancetype )initWithEditor : (id )editor {
Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ + (StyleType)getStyleType { return UnorderedList; }
1313
1414- (CGFloat)getHeadIndent {
1515 // lists are drawn manually
16- // margin before bullet + bullet size + gap between bullet and paragraph
17- return [_editor->config unorderedListMarginLeft ] + [_editor->config unorderedListBulletSize ] + [_editor->config unorderedListGapWidth ];
16+ // margin before bullet + gap between bullet and paragraph
17+ return [_editor->config unorderedListMarginLeft ] + [_editor->config unorderedListGapWidth ];
1818}
1919
2020- (instancetype )initWithEditor : (id )editor {
Original file line number Diff line number Diff line change @@ -107,14 +107,13 @@ - (void)my_drawBackgroundForGlyphRange:(NSRange)glyphRange atPoint:(CGPoint)orig
107107 if (pStyle.textLists .firstObject .markerFormat == NSTextListMarkerDecimal ) {
108108 CGFloat gapWidth = [typedEditor->config orderedListGapWidth ];
109109 CGFloat markerWidth = [marker sizeWithAttributes: markerAttributes].width ;
110- CGFloat rightEdge = usedRect.origin .x - gapWidth;
111- CGFloat numberX = rightEdge - markerWidth;
110+ CGFloat markerX = usedRect.origin .x - gapWidth - markerWidth/2 ;
112111
113- [marker drawAtPoint: CGPointMake (numberX , usedRect.origin.y + origin.y) withAttributes: markerAttributes];
112+ [marker drawAtPoint: CGPointMake (markerX , usedRect.origin.y + origin.y) withAttributes: markerAttributes];
114113 } else {
115114 CGFloat gapWidth = [typedEditor->config unorderedListGapWidth ];
116115 CGFloat bulletSize = [typedEditor->config unorderedListBulletSize ];
117- CGFloat bulletX = usedRect.origin .x - gapWidth - bulletSize;
116+ CGFloat bulletX = usedRect.origin .x - gapWidth - bulletSize/ 2 ;
118117 CGFloat centerY = CGRectGetMidY (usedRect);
119118
120119 CGContextRef context = UIGraphicsGetCurrentContext ();
You can’t perform that action at this time.
0 commit comments