Changeset View
Changeset View
Standalone View
Standalone View
applets/taskmanager/package/contents/code/layout.js
Context not available. | |||||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * | ||
---|---|---|---|---|---|
18 | ***************************************************************************/ | 18 | ***************************************************************************/ | ||
19 | 19 | | |||
20 | var iconSizes = ["small", "smallMedium", "medium", "large", "huge", "enormous"]; | ||||
21 | | ||||
20 | function horizontalMargins() { | 22 | function horizontalMargins() { | ||
21 | return taskFrame.margins.left + taskFrame.margins.right; | 23 | return taskFrame.margins.left + taskFrame.margins.right; | ||
22 | } | 24 | } | ||
Context not available. | |||||
132 | } | 134 | } | ||
133 | 135 | | |||
134 | function preferredMaxHeight() { | 136 | function preferredMaxHeight() { | ||
135 | return verticalMargins() + Math.min(units.iconSizes.small * 3, theme.mSize(theme.defaultFont).height * 3); | 137 | if (tasks.vertical) { | ||
138 | return verticalMargins() | ||||
139 | + Math.min( | ||||
140 | // Do not allow the preferred icon size to exceed the width of the vertical task manager. | ||||
141 | tasks.width, | ||||
142 | Math.max( | ||||
143 | // This assumes that we show some text and that we need some minimal vertical space for it. | ||||
144 | // In reality, we do not always show the text. We show the text only if there | ||||
145 | // is enough horizontal space for some hard coded amount of 'm' characters | ||||
146 | // - see minimumMColumns() below. | ||||
147 | // Hence in case the user prefers icons smaller than the height of his font, | ||||
148 | // the font height will win even if the text will stay invisible. | ||||
149 | // We leave it for the future developers to improve this expresssion if the | ||||
150 | // named corner case turns out to be important. | ||||
151 | units.iconSizes[iconSizes[plasmoid.configuration.iconSize]], | ||||
152 | theme.mSize(theme.defaultFont).height | ||||
153 | ) | ||||
154 | ); | ||||
155 | } else { | ||||
156 | return verticalMargins() + Math.min(units.iconSizes.small * 3, theme.mSize(theme.defaultFont).height * 3); | ||||
157 | } | ||||
158 | } | ||||
159 | | ||||
160 | // Returns the number of 'm' characters whose joint width must be available in the task button label | ||||
161 | // so that the button text is rendered at all. | ||||
162 | function minimumMColumns() { | ||||
163 | return tasks.vertical ? 4 : 5; | ||||
136 | } | 164 | } | ||
137 | 165 | | |||
138 | function taskWidth() { | 166 | function taskWidth() { | ||
Context not available. |