New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delayed rendering leads to ugly UI #173
Comments
Do you have a minimal example I can use to reproduce the issue? I tried with the following (it's a modified version of Tutorial 02), but it looks good for me (tested on macOS and Ubuntu 21.04): {-|
Module : Tutorial02_Styling
Copyright : (c) 2018 Francisco Vallarino
License : BSD-3-Clause (see the LICENSE file)
Maintainer : fjvallarino@gmail.com
Stability : experimental
Portability : non-portable
Main module for the '02 - Styling' tutorial.
-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module Tutorial02_Styling where
import Control.Lens
import Data.Text (Text)
import Monomer
import qualified Monomer.Lens as L
data AppModel = AppModel {
_sampleText :: Text,
_showPicker :: Bool,
_fontName :: Font,
_fontSize :: Double,
_fontColor :: Color,
_topVisible :: Bool,
_compVal :: ()
} deriving (Eq, Show)
data AppEvent
= AppInit
| AppShow
| AppHide
deriving (Eq, Show)
makeLenses 'AppModel
buildComp :: WidgetEnv () () -> () -> WidgetNode () ()
buildComp wenv model = vstack [
tooltip "Test" (button "AAAA" ())
] `styleBasic` [minHeight 100, bgColor gray]
handleComp :: WidgetEnv () () -> WidgetNode () () -> () -> () -> [EventResponse () () AppModel AppEvent]
handleComp wenv node model evt = [
Report AppHide
]
buildUI
:: WidgetEnv AppModel AppEvent
-> AppModel
-> WidgetNode AppModel AppEvent
buildUI wenv model = widgetTree where
widgetTree = zstack [
bottomPanel,
topPanel
`nodeVisible` (model ^. topVisible)
]
topPanel = composite "" compVal buildComp handleComp
bottomPanel = vstack [
titleText "Text",
box (textField sampleText) `styleBasic` [paddingV 10],
tooltip "Test" (button "AAAA" AppShow),
titleText "Font name",
hgrid [
hstack [
labeledRadio "Regular " "Regular" fontName,
filler
],
hstack [
labeledRadio "Medium " "Medium" fontName,
filler
],
hstack [
labeledRadio "Bold " "Bold" fontName,
filler
],
hstack [
labeledRadio "Italic " "Italic" fontName
]
] `styleBasic` [paddingV 10],
titleText "Font size",
hslider fontSize 10 200
`styleBasic` [paddingV 10, fgColor orange],
titleText "Font color",
hstack [
labeledCheckbox "Show color picker " showPicker,
filler
] `styleBasic` [paddingT 10, paddingB 5],
colorPicker fontColor
`nodeVisible` (model ^. showPicker)
`styleBasic` [paddingB 10],
sampleTextLabel
] `styleBasic` [padding 10]
titleText text = label text
`styleBasic` [textFont "Medium", textSize 20]
sampleTextLabel = label_ (model ^. sampleText) [ellipsis]
`styleBasic` [
bgColor dimGray,
border 4 lightGray,
radius 10,
textFont (model ^. fontName),
textSize (model ^. fontSize),
textColor (model ^. fontColor),
textCenter,
flexHeight 100]
handleEvent
:: WidgetEnv AppModel AppEvent
-> WidgetNode AppModel AppEvent
-> AppModel
-> AppEvent
-> [AppEventResponse AppModel AppEvent]
handleEvent wenv node model evt = case evt of
AppInit -> []
AppShow -> [Model $ model & topVisible .~ True]
AppHide -> [Model $ model & topVisible .~ False]
main02 :: IO ()
main02 = do
startApp model handleEvent buildUI config
where
config = [
appWindowTitle "Tutorial 02 - Styling",
appWindowIcon "./assets/images/icon.bmp",
appTheme darkTheme,
appFontDef "Regular" "./assets/fonts/Roboto-Regular.ttf",
appFontDef "Medium" "./assets/fonts/Roboto-Medium.ttf",
appFontDef "Bold" "./assets/fonts/Roboto-Bold.ttf",
appFontDef "Italic" "./assets/fonts/Roboto-Italic.ttf",
appInitEvent AppInit
]
model = AppModel {
_sampleText = "Hello World!",
_showPicker = False,
_fontName = "Regular",
_fontSize = 24,
_fontColor = white,
_topVisible = False,
_compVal = ()
} |
Try to use this as widget within the main UI.
…On Thu, Jun 16, 2022, 23:41 Francisco Vallarino ***@***.***> wrote:
Do you have a minimal example I can use to reproduce the issue? I tried
with the following (it's a modified version of Tutorial 02), but it looks
good for me (tested on macOS and Ubuntu 21.04):
{-|Module : Tutorial02_StylingCopyright : (c) 2018 Francisco VallarinoLicense : BSD-3-Clause (see the LICENSE file)Maintainer : ***@***.*** : experimentalPortability : non-portableMain module for the '02 - Styling' tutorial.-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module Tutorial02_Styling where
import Control.Lensimport Data.Text (Text)import Monomer
import qualified Monomer.Lens as L
data AppModel = AppModel {
_sampleText :: Text,
_showPicker :: Bool,
_fontName :: Font,
_fontSize :: Double,
_fontColor :: Color,
_topVisible :: Bool,
_compVal :: ()} deriving (Eq, Show)
data AppEvent
= AppInit
| AppShow
| AppHide
deriving (Eq, Show)
makeLenses 'AppModel
buildComp :: WidgetEnv () () -> () -> WidgetNode () ()
buildComp wenv model = vstack [
tooltip "Test" (button "AAAA" ())
] `styleBasic` [minHeight 100, bgColor gray]
handleComp :: WidgetEnv () () -> WidgetNode () () -> () -> () -> [EventResponse () () AppModel AppEvent]
handleComp wenv node model evt = [
Report AppHide
]
buildUI
:: WidgetEnv AppModel AppEvent
-> AppModel
-> WidgetNode AppModel AppEvent
buildUI wenv model = widgetTree where
widgetTree = zstack [
bottomPanel,
topPanel
`nodeVisible` (model ^. topVisible)
]
topPanel = composite "" compVal buildComp handleComp
bottomPanel = vstack [
titleText "Text",
box (textField sampleText) `styleBasic` [paddingV 10],
tooltip "Test" (button "AAAA" AppShow),
titleText "Font name",
hgrid [
hstack [
labeledRadio "Regular " "Regular" fontName,
filler
],
hstack [
labeledRadio "Medium " "Medium" fontName,
filler
],
hstack [
labeledRadio "Bold " "Bold" fontName,
filler
],
hstack [
labeledRadio "Italic " "Italic" fontName
]
] `styleBasic` [paddingV 10],
titleText "Font size",
hslider fontSize 10 200
`styleBasic` [paddingV 10, fgColor orange],
titleText "Font color",
hstack [
labeledCheckbox "Show color picker " showPicker,
filler
] `styleBasic` [paddingT 10, paddingB 5],
colorPicker fontColor
`nodeVisible` (model ^. showPicker)
`styleBasic` [paddingB 10],
sampleTextLabel
] `styleBasic` [padding 10]
titleText text = label text
`styleBasic` [textFont "Medium", textSize 20]
sampleTextLabel = label_ (model ^. sampleText) [ellipsis]
`styleBasic` [
bgColor dimGray,
border 4 lightGray,
radius 10,
textFont (model ^. fontName),
textSize (model ^. fontSize),
textColor (model ^. fontColor),
textCenter,
flexHeight 100]
handleEvent
:: WidgetEnv AppModel AppEvent
-> WidgetNode AppModel AppEvent
-> AppModel
-> AppEvent
-> [AppEventResponse AppModel AppEvent]
handleEvent wenv node model evt = case evt of
AppInit -> []
AppShow -> [Model $ model & topVisible .~ True]
AppHide -> [Model $ model & topVisible .~ False]
main02 :: IO ()
main02 = do
startApp model handleEvent buildUI config
where
config = [
appWindowTitle "Tutorial 02 - Styling",
appWindowIcon "./assets/images/icon.bmp",
appTheme darkTheme,
appFontDef "Regular" "./assets/fonts/Roboto-Regular.ttf",
appFontDef "Medium" "./assets/fonts/Roboto-Medium.ttf",
appFontDef "Bold" "./assets/fonts/Roboto-Bold.ttf",
appFontDef "Italic" "./assets/fonts/Roboto-Italic.ttf",
appInitEvent AppInit
]
model = AppModel {
_sampleText = "Hello World!",
_showPicker = False,
_fontName = "Regular",
_fontSize = 24,
_fontColor = white,
_topVisible = False,
_compVal = ()
}
—
Reply to this email directly, view it on GitHub
<#173 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADAJPBQW4C5LZIFHKDSXV3VPPXWNANCNFSM5Y5BEFIA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I'm not sure I follow. The example I pasted has a composite embedded in the main UI and a zstack to simulate what you show in the videos. If possible, could you modify the example and paste it here with your proposed changes? |
That's weird, I can reproduce the issue with your example. See attached video. pl-next-2022-06-17_14.49.04.mp4 |
I assume that's Linux. What window manager are you using? I can create a VM to test it in the next few days. |
Kubuntu 20.04 |
I created a PR with a fix/workaround that solves the issue, at least on my end. This seems to be somehow platform dependent, since it does not happen on my older machine (which is the reason I could not work on it earlier): #215 You can test the fix by modifying your - git: https://github.com/fjvallarino/monomer.git
commit: 53647710e856da733d69fcf1639976e5824cbb0d |
I can confirm: with this commit I have no more rounded corners artifacts I described in #173 (comment). Nice and clean now! 👍 |
I will try to verify this weekend as well.
…On Fri, Oct 21, 2022, 20:09 dimsuz ***@***.***> wrote:
I can confirm: with this commit I have no more rounded corners artifacts I
described in #173 (comment)
<#173 (comment)>.
Nice and clean now! 👍
—
Reply to this email directly, view it on GitHub
<#173 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AADAJPG6E5LABX6WOD3O4GLWEMPBFANCNFSM5Y5BEFIA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I feel the solution/workaround for #180 could be something similar to what was done for this issue. I'll close the issue for the time being, since it appears to work correctly now. If you happen to test it and it does not work as expected, please let me know (re-open the issue or create a new one, as you prefer). Thanks! |
I attached two video to demonstrate the problem.
The rounded corners
( styleBasic [ radius 4 ] )
are appearing, but very often it takes a second, which is kind of annoying. Not only tooltips are affected, but also buttons.pl-next-2022-06-15_20.03.58.mp4
Here in the second video you can see the same quick flicker for buttons, overlays and close icons.
pl-next-2022-06-15_20.09.38.mp4
The text was updated successfully, but these errors were encountered: