diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/sidebarwidget.c | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/src/ui/sidebarwidget.c b/src/ui/sidebarwidget.c index 16677f9e..da0ec22c 100644 --- a/src/ui/sidebarwidget.c +++ b/src/ui/sidebarwidget.c | |||
@@ -1181,39 +1181,43 @@ static iBool handleSidebarCommand_SidebarWidget_(iSidebarWidget *d, const char * | |||
1181 | argLabel_Command(cmd, "noanim") == 0 && | 1181 | argLabel_Command(cmd, "noanim") == 0 && |
1182 | (d->side == left_SidebarSide || deviceType_App() != phone_AppDeviceType); | 1182 | (d->side == left_SidebarSide || deviceType_App() != phone_AppDeviceType); |
1183 | int visX = 0; | 1183 | int visX = 0; |
1184 | int visY = 0; | 1184 | // int visY = 0; |
1185 | if (isVisible_Widget(w)) { | 1185 | if (isVisible_Widget(w)) { |
1186 | visX = left_Rect(bounds_Widget(w)) - left_Rect(w->root->widget->rect); | 1186 | visX = left_Rect(bounds_Widget(w)) - left_Rect(w->root->widget->rect); |
1187 | visY = top_Rect(bounds_Widget(w)) - top_Rect(w->root->widget->rect); | 1187 | // visY = top_Rect(bounds_Widget(w)) - top_Rect(w->root->widget->rect); |
1188 | } | 1188 | } |
1189 | const iBool isHiding = isVisible_Widget(w); | 1189 | const iBool isHiding = isVisible_Widget(w); |
1190 | setFlags_Widget(w, hidden_WidgetFlag, isHiding); | 1190 | setFlags_Widget(w, hidden_WidgetFlag, isHiding); |
1191 | /* Safe area inset for mobile. */ | 1191 | /* Safe area inset for mobile. */ |
1192 | const int safePad = (d->side == left_SidebarSide ? left_Rect(safeRect_Root(w->root)) : 0); | 1192 | const int safePad = |
1193 | deviceType_App() == desktop_AppDeviceType | ||
1194 | ? 0 | ||
1195 | : (d->side == left_SidebarSide ? left_Rect(safeRect_Root(w->root)) : 0); | ||
1193 | const int animFlags = easeOut_AnimFlag | softer_AnimFlag; | 1196 | const int animFlags = easeOut_AnimFlag | softer_AnimFlag; |
1194 | if (!isPortraitPhone_App()) { | 1197 | if (!isPortraitPhone_App()) { |
1195 | if (!isHiding) { | 1198 | if (!isHiding) { |
1196 | setFlags_Widget(w, keepOnTop_WidgetFlag, iFalse); | 1199 | setFlags_Widget(w, keepOnTop_WidgetFlag, iFalse); |
1197 | w->rect.size.x = d->widthAsGaps * gap_UI; | 1200 | w->rect.size.x = d->widthAsGaps * gap_UI; |
1198 | invalidate_ListWidget(d->list); | 1201 | invalidate_ListWidget(d->list); |
1199 | if (isAnimated) { | 1202 | if (isAnimated) { |
1200 | setFlags_Widget(w, horizontalOffset_WidgetFlag, iTrue); | 1203 | setFlags_Widget(w, horizontalOffset_WidgetFlag, iTrue); |
1201 | setVisualOffset_Widget( | 1204 | setVisualOffset_Widget(w, |
1202 | w, (d->side == left_SidebarSide ? -1 : 1) * (w->rect.size.x + safePad), 0, 0); | 1205 | (d->side == left_SidebarSide ? -1 : 1) * |
1206 | (w->rect.size.x + safePad), | ||
1207 | 0, | ||
1208 | 0); | ||
1203 | setVisualOffset_Widget(w, 0, 300, animFlags); | 1209 | setVisualOffset_Widget(w, 0, 300, animFlags); |
1210 | } | ||
1204 | } | 1211 | } |
1205 | } | 1212 | else if (isAnimated) { |
1206 | else if (isAnimated) { | 1213 | setFlags_Widget(w, horizontalOffset_WidgetFlag, iTrue); |
1207 | setFlags_Widget(w, horizontalOffset_WidgetFlag, iTrue); | 1214 | if (d->side == right_SidebarSide) { |
1208 | if (d->side == right_SidebarSide) { | 1215 | setVisualOffset_Widget(w, visX, 0, 0); |
1209 | setVisualOffset_Widget(w, visX, 0, 0); | 1216 | setVisualOffset_Widget(w, visX + w->rect.size.x + safePad, 300, animFlags); |
1210 | setVisualOffset_Widget( | 1217 | } |
1211 | w, visX + w->rect.size.x + safePad, 300, animFlags); | 1218 | else { |
1212 | } | 1219 | setFlags_Widget(w, keepOnTop_WidgetFlag, iTrue); |
1213 | else { | 1220 | setVisualOffset_Widget(w, -w->rect.size.x - safePad, 300, animFlags); |
1214 | setFlags_Widget(w, keepOnTop_WidgetFlag, iTrue); | ||
1215 | setVisualOffset_Widget( | ||
1216 | w, -w->rect.size.x - safePad, 300, animFlags); | ||
1217 | } | 1221 | } |
1218 | } | 1222 | } |
1219 | setScrollMode_ListWidget(d->list, normal_ScrollMode); | 1223 | setScrollMode_ListWidget(d->list, normal_ScrollMode); |
@@ -1226,15 +1230,16 @@ static iBool handleSidebarCommand_SidebarWidget_(iSidebarWidget *d, const char * | |||
1226 | w->rect.pos.y = height_Rect(safeRect_Root(w->root)) - d->midHeight; | 1230 | w->rect.pos.y = height_Rect(safeRect_Root(w->root)) - d->midHeight; |
1227 | setVisualOffset_Widget(w, bottom_Rect(rect_Root(w->root)) - w->rect.pos.y, 0, 0); | 1231 | setVisualOffset_Widget(w, bottom_Rect(rect_Root(w->root)) - w->rect.pos.y, 0, 0); |
1228 | setVisualOffset_Widget(w, 0, 300, animFlags); | 1232 | setVisualOffset_Widget(w, 0, 300, animFlags); |
1229 | //animateSlidingSheetHeight_SidebarWidget_(d); | 1233 | // animateSlidingSheetHeight_SidebarWidget_(d); |
1230 | setScrollMode_ListWidget(d->list, disabledAtTopBothDirections_ScrollMode); | 1234 | setScrollMode_ListWidget(d->list, disabledAtTopBothDirections_ScrollMode); |
1231 | } | 1235 | } |
1232 | else { | 1236 | else { |
1233 | setVisualOffset_Widget(w, bottom_Rect(rect_Root(w->root)) - w->rect.pos.y, 300, animFlags); | 1237 | setVisualOffset_Widget( |
1238 | w, bottom_Rect(rect_Root(w->root)) - w->rect.pos.y, 300, animFlags); | ||
1234 | if (d->isEditing) { | 1239 | if (d->isEditing) { |
1235 | setMobileEditMode_SidebarWidget_(d, iFalse); | 1240 | setMobileEditMode_SidebarWidget_(d, iFalse); |
1241 | } | ||
1236 | } | 1242 | } |
1237 | } | ||
1238 | showToolbar_Root(w->root, isHiding); | 1243 | showToolbar_Root(w->root, isHiding); |
1239 | } | 1244 | } |
1240 | updateToolbarColors_Root(w->root); | 1245 | updateToolbarColors_Root(w->root); |
@@ -1242,7 +1247,7 @@ static iBool handleSidebarCommand_SidebarWidget_(iSidebarWidget *d, const char * | |||
1242 | /* BUG: Rearranging because the arrange above didn't fully resolve the height. */ | 1247 | /* BUG: Rearranging because the arrange above didn't fully resolve the height. */ |
1243 | arrange_Widget(w); | 1248 | arrange_Widget(w); |
1244 | if (!isPortraitPhone_App()) { | 1249 | if (!isPortraitPhone_App()) { |
1245 | updateSize_DocumentWidget(document_App()); | 1250 | updateSize_DocumentWidget(document_App()); |
1246 | } | 1251 | } |
1247 | if (isVisible_Widget(w)) { | 1252 | if (isVisible_Widget(w)) { |
1248 | updateItems_SidebarWidget_(d); | 1253 | updateItems_SidebarWidget_(d); |