File tree Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ export component MarkdownText inherits Empty {
129129 in property <brush > color ;
130130 in property <TextHorizontalAlignment > horizontal-alignment ;
131131 in property <TextVerticalAlignment > vertical-alignment ;
132+ in property <color > link-color : #00f ;
132133
133134 in property <string > font-family ;
134135 in property <bool > font-italic ;
Original file line number Diff line number Diff line change 55//! module for rendering the tree of items
66
77use super :: items:: * ;
8- use crate :: graphics:: { FontRequest , Image , IntRect } ;
8+ use crate :: graphics:: { Color , FontRequest , Image , IntRect } ;
99use crate :: item_tree:: ItemTreeRc ;
1010use crate :: item_tree:: { ItemVisitor , ItemVisitorVTable , VisitChildrenResult } ;
1111use crate :: lengths:: {
@@ -299,6 +299,7 @@ pub trait RenderText {
299299 fn letter_spacing ( self : Pin < & Self > ) -> LogicalLength ;
300300 fn stroke ( self : Pin < & Self > ) -> ( Brush , LogicalLength , TextStrokeStyle ) ;
301301 fn is_markdown ( self : Pin < & Self > ) -> bool ;
302+ fn link_color ( self : Pin < & Self > ) -> Color ;
302303}
303304
304305impl RenderText for ( SharedString , Brush ) {
@@ -318,6 +319,10 @@ impl RenderText for (SharedString, Brush) {
318319 self . 1 . clone ( )
319320 }
320321
322+ fn link_color ( self : Pin < & Self > ) -> Color {
323+ Default :: default ( )
324+ }
325+
321326 fn alignment (
322327 self : Pin < & Self > ,
323328 ) -> ( crate :: items:: TextHorizontalAlignment , crate :: items:: TextVerticalAlignment ) {
Original file line number Diff line number Diff line change @@ -179,6 +179,10 @@ impl RenderText for ComplexText {
179179 self . color ( )
180180 }
181181
182+ fn link_color ( self : Pin < & Self > ) -> Color {
183+ Default :: default ( )
184+ }
185+
182186 fn alignment (
183187 self : Pin < & Self > ,
184188 ) -> ( super :: TextHorizontalAlignment , super :: TextVerticalAlignment ) {
@@ -241,6 +245,7 @@ pub struct MarkdownText {
241245 pub stroke : Property < Brush > ,
242246 pub stroke_width : Property < LogicalLength > ,
243247 pub stroke_style : Property < TextStrokeStyle > ,
248+ pub link_color : Property < Color > ,
244249 pub cached_rendering_data : CachedRenderingData ,
245250}
246251
@@ -362,6 +367,10 @@ impl RenderText for MarkdownText {
362367 self . color ( )
363368 }
364369
370+ fn link_color ( self : Pin < & Self > ) -> Color {
371+ self . link_color ( )
372+ }
373+
365374 fn alignment (
366375 self : Pin < & Self > ,
367376 ) -> ( super :: TextHorizontalAlignment , super :: TextVerticalAlignment ) {
@@ -537,6 +546,10 @@ impl RenderText for SimpleText {
537546 self . color ( )
538547 }
539548
549+ fn link_color ( self : Pin < & Self > ) -> Color {
550+ Default :: default ( )
551+ }
552+
540553 fn alignment (
541554 self : Pin < & Self > ,
542555 ) -> ( super :: TextHorizontalAlignment , super :: TextVerticalAlignment ) {
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ impl LayoutOptions {
141141 stroke : None ,
142142 text_wrap : text_input. wrap ( ) ,
143143 text_overflow : TextOverflow :: Clip ,
144- link_color : crate :: Color :: from_rgb_u8 ( 64 , 64 , 255 ) ,
144+ link_color : Default :: default ( ) ,
145145 }
146146 }
147147}
@@ -1181,7 +1181,7 @@ pub fn draw_text(
11811181 text_overflow,
11821182 selection : None ,
11831183 selection_foreground_color : None ,
1184- link_color : crate :: Color :: from_rgb_u8 ( 64 , 64 , 255 ) ,
1184+ link_color : text . link_color ( ) ,
11851185 } ,
11861186 ) ;
11871187
@@ -1305,7 +1305,7 @@ pub fn text_size(
13051305 text_overflow : TextOverflow :: Clip ,
13061306 selection : None ,
13071307 selection_foreground_color : None ,
1308- link_color : crate :: Color :: from_rgb_u8 ( 64 , 64 , 255 ) ,
1308+ link_color : Default :: default ( ) ,
13091309 } ,
13101310 ) ;
13111311 PhysicalSize :: from_lengths ( layout. max_width , layout. height ) / scale_factor
You can’t perform that action at this time.
0 commit comments