4343#include " Boxes/smartvectorpath.h"
4444#include " themesupport.h"
4545
46- PathBox::PathBox (const QString &name, const eBoxType type) :
47- BoxWithPathEffects(name, type) {
48- connect (this , &eBoxOrSound::parentChanged, this , [this ]() {
46+ PathBox::PathBox (const QString &name,
47+ const eBoxType type)
48+ : BoxWithPathEffects(name, type)
49+ {
50+ connect (this , &eBoxOrSound::parentChanged,
51+ this , [this ]() {
4952 setPathsOutdated (UpdateReason::userChange);
5053 });
5154
52- connect (mPathEffectsAnimators .get (), &Property::prp_currentFrameChanged,
55+ connect (mPathEffectsAnimators .get (),
56+ &Property::prp_currentFrameChanged,
5357 this , [this ](const UpdateReason reason) {
5458 setPathsOutdated (reason);
5559 });
5660
57- connect (mFillPathEffectsAnimators .get (), &Property::prp_currentFrameChanged,
61+ connect (mFillPathEffectsAnimators .get (),
62+ &Property::prp_currentFrameChanged,
5863 this , [this ](const UpdateReason reason) {
5964 setFillPathOutdated (reason);
6065 });
6166
62- connect (mOutlineBasePathEffectsAnimators .get (), &Property::prp_currentFrameChanged,
67+ connect (mOutlineBasePathEffectsAnimators .get (),
68+ &Property::prp_currentFrameChanged,
6369 this , [this ](const UpdateReason reason) {
6470 setOutlinePathOutdated (reason);
6571 });
6672
67- connect (mOutlinePathEffectsAnimators .get (), &Property::prp_currentFrameChanged,
73+ connect (mOutlinePathEffectsAnimators .get (),
74+ &Property::prp_currentFrameChanged,
6875 this , [this ](const UpdateReason reason) {
6976 setOutlinePathOutdated (reason);
7077 });
@@ -74,8 +81,24 @@ PathBox::PathBox(const QString &name, const eBoxType type) :
7481 mStrokeSettings = enve::make_shared<OutlineSettingsAnimator>(this );
7582 mStrokeGradientPoints = mFillSettings ->getGradientPoints ();
7683
77- mStrokeSettings ->setPaintType (PaintType::FLATPAINT);
78- mStrokeSettings ->setCurrentColor (ThemeSupport::getThemeObjectColor ());
84+ bool fillFlat = eSettings::instance ().fLastFillFlatEnabled ;
85+ bool strokeFlat = eSettings::instance ().fLastStrokeFlatEnabled ;
86+ if (!fillFlat && !strokeFlat) { strokeFlat = true ; }
87+
88+ switch (type) {
89+ case eBoxType::circle:
90+ case eBoxType::rectangle:
91+ mFillSettings ->setPaintType (fillFlat ?
92+ PaintType::FLATPAINT : PaintType::NOPAINT);
93+ mStrokeSettings ->setPaintType (strokeFlat ?
94+ PaintType::FLATPAINT : PaintType::NOPAINT);
95+ break ;
96+ default :
97+ mStrokeSettings ->setPaintType (PaintType::FLATPAINT);
98+ }
99+
100+ mFillSettings ->setCurrentColor (eSettings::instance ().fLastUsedFillColor );
101+ mStrokeSettings ->setCurrentColor (eSettings::instance ().fLastUsedStrokeColor );
79102
80103 ca_prependChild (mPathEffectsAnimators .get (), mFillSettings );
81104 ca_prependChild (mPathEffectsAnimators .get (), mStrokeSettings );
@@ -90,6 +113,29 @@ PathBox::PathBox(const QString &name, const eBoxType type) :
90113 const auto brushSettings = mStrokeSettings ->getBrushSettings ();
91114 connect (brushSettings, &BrushSettingsAnimator::brushChanged,
92115 this , &BoundingBox::brushChanged);
116+
117+ connect (mFillSettings .get (),
118+ &PaintSettingsAnimator::paintTypeChanged,
119+ this , [this ](const PaintType &type) {
120+ switch (getBoxType ()) {
121+ case eBoxType::circle:
122+ case eBoxType::rectangle:
123+ eSettings::sInstance ->fLastFillFlatEnabled = (type == PaintType::FLATPAINT);
124+ break ;
125+ default :;
126+ }
127+ });
128+ connect (mStrokeSettings .get (),
129+ &PaintSettingsAnimator::paintTypeChanged,
130+ this , [this ](const PaintType &type) {
131+ switch (getBoxType ()) {
132+ case eBoxType::circle:
133+ case eBoxType::rectangle:
134+ eSettings::sInstance ->fLastStrokeFlatEnabled = (type == PaintType::FLATPAINT);
135+ break ;
136+ default :;
137+ }
138+ });
93139}
94140
95141HardwareSupport PathBox::hardwareSupport () const {
0 commit comments