@@ -53,12 +53,12 @@ void DrawLegend::draw(Gfx::ICanvas &canvas,
5353 .titleRect = titleRect,
5454 .markerWindowRect = markerWindowRect,
5555 .fadeHeight = fadeHeight,
56- .type = channelType,
5756 .weight = weight,
5857 .itemHeight = itemHeight,
5958 .markerSize = markerSize,
6059 .measure = plot->axises .at (channelType).measure ,
6160 .dimension = plot->axises .at (channelType).dimension ,
61+ .properties = {.channel = channelType},
6262 .colorGradientSetter = {markerWindowRect.leftSide (),
6363 Gfx::ColorGradient{{
6464 {0.0 , {}},
@@ -78,7 +78,7 @@ void DrawLegend::draw(Gfx::ICanvas &canvas,
7878 legendLayout,
7979 style,
8080 *events.background ,
81- Events::Targets::legend (channelType, info.properties ));
81+ Events::Targets::legend (info.properties ));
8282
8383 canvas.save ();
8484
@@ -113,26 +113,26 @@ void DrawLegend::ColorGradientSetter::operator()(Gfx::ICanvas &canvas,
113113
114114void DrawLegend::drawTitle (const Info &info) const
115115{
116- plot->axises .at (info.type ). common . title . visit (
117- [ this ,
118- &info ,
119- &rect = info. titleRect ,
120- mul = std::max< double >( info.measureEnabled ,
121- info. dimensionEnabled )](::Anim::InterpolateIndex ,
122- const auto &title)
123- {
124- if (title. weight <= 0 ) return ;
125-
126- DrawLabel{{ ctx ()}}. draw (info. canvas ,
127- Geom::TransformedRect::fromRect (rect) ,
128- title. value ,
129- style. title ,
130- *events .title ,
131- Events::Targets::legendTitle (title. value ,
132- info. type ,
133- info.properties ),
134- {.alpha = title.weight * info.weight * mul});
135- });
116+ plot->axises .at (info.properties . channel )
117+ . common . title . visit (
118+ [ this ,
119+ & info,
120+ &rect = info.titleRect ,
121+ mul = std::max< double >(info. measureEnabled ,
122+ info. dimensionEnabled )](::Anim::InterpolateIndex,
123+ const auto &title)
124+ {
125+ if (title. weight <= 0 ) return ;
126+
127+ DrawLabel{{ ctx ()}}. draw (info. canvas ,
128+ Geom::TransformedRect::fromRect (rect) ,
129+ title. value ,
130+ style .title ,
131+ *events. title ,
132+ Events::Targets::legendTitle (title. value ,
133+ info.properties ),
134+ {.alpha = title.weight * info.weight * mul});
135+ });
136136}
137137
138138void DrawLegend::drawDimension (const Info &info) const
@@ -180,7 +180,7 @@ void DrawLegend::drawDimension(const Info &info) const
180180 info.dimension .category ,
181181 value.second .categoryValue ,
182182 value.second .categoryValue ,
183- info. type ,
183+
184184 info.properties ),
185185 {.alpha =
186186 double {
@@ -247,7 +247,7 @@ void DrawLegend::drawMarker(const Info &info,
247247 auto markerElement =
248248 Events::Targets::legendMarker (info.dimension .category ,
249249 categoryValue,
250- info. type ,
250+
251251 info.properties );
252252
253253 if (events.marker ->invoke (
@@ -282,7 +282,7 @@ void DrawLegend::drawMeasure(const Info &info) const
282282 auto bar = getBarRect (info);
283283
284284 using ST = Gen::ChannelId;
285- switch (info.type ) {
285+ switch (info.properties . channel ) {
286286 case ST::color: colorBar (info, bar); break ;
287287 case ST::lightness: lightnessBar (info, bar); break ;
288288 case ST::size: sizeBar (info, bar); break ;
@@ -308,7 +308,7 @@ void DrawLegend::extremaLabel(const Info &info,
308308 style.label ,
309309 *events.label ,
310310 Events::Targets::measLegendLabel (text,
311- info. type ,
311+
312312 info.properties ),
313313 {.alpha = info.measureWeight * plusWeight});
314314}
@@ -346,9 +346,7 @@ void DrawLegend::colorBar(const Info &info,
346346 info.canvas .setLineColor (Gfx::Color::Transparent ());
347347 info.canvas .setLineWidth (0 );
348348
349- auto barElement =
350- Events::Targets::legendBar (Gen::ChannelId::color,
351- info.properties );
349+ auto barElement = Events::Targets::legendBar (info.properties );
352350
353351 if (events.bar ->invoke (
354352 Events::OnRectDrawEvent (*barElement, {rect, false }))) {
@@ -379,9 +377,7 @@ void DrawLegend::lightnessBar(const Info &info,
379377 info.canvas .setLineColor (Gfx::Color::Transparent ());
380378 info.canvas .setLineWidth (0 );
381379
382- auto barElement =
383- Events::Targets::legendBar (Gen::ChannelId::lightness,
384- info.properties );
380+ auto barElement = Events::Targets::legendBar (info.properties );
385381
386382 if (events.bar ->invoke (
387383 Events::OnRectDrawEvent (*barElement, {rect, false }))) {
@@ -402,8 +398,7 @@ void DrawLegend::sizeBar(const Info &info,
402398 Gfx::Color::Gray (0.8 ) * info.measureWeight );
403399 info.canvas .setLineWidth (0 );
404400
405- auto barElement = Events::Targets::legendBar (Gen::ChannelId::size,
406- info.properties );
401+ auto barElement = Events::Targets::legendBar (info.properties );
407402
408403 if (events.bar ->invoke (
409404 Events::OnRectDrawEvent (*barElement, {rect, false }))) {
0 commit comments