Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/view2d.cc
| Show First 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | if (!(v2d->scroll & V2D_SCROLL_VERTICAL_HANDLES)) { | ||||
| v2d->scroll &= ~V2D_SCROLL_VERTICAL_FULLR; | v2d->scroll &= ~V2D_SCROLL_VERTICAL_FULLR; | ||||
| } | } | ||||
| else { | else { | ||||
| v2d->scroll |= V2D_SCROLL_VERTICAL_FULLR; | v2d->scroll |= V2D_SCROLL_VERTICAL_FULLR; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| scroll = view2d_scroll_mapped(v2d->scroll); | /* Do not use mapped scroll here because we want to update scroller rects | ||||
| * even if they are not displayed. For init purposes. See T75003.*/ | |||||
| scroll = v2d->scroll; | |||||
| /* Scrollers are based off region-size: | /* Scrollers are based off region-size: | ||||
| * - they can only be on one to two edges of the region they define | * - they can only be on one to two edges of the region they define | ||||
| * - if they overlap, they must not occupy the corners (which are reserved for other widgets) | * - if they overlap, they must not occupy the corners (which are reserved for other widgets) | ||||
| */ | */ | ||||
| if (scroll) { | if (scroll) { | ||||
| float scroll_width, scroll_height; | float scroll_width, scroll_height; | ||||
| UI_view2d_scroller_size_get(v2d, &scroll_width, &scroll_height); | UI_view2d_scroller_size_get(v2d, false, &scroll_width, &scroll_height); | ||||
| /* vertical scroller */ | /* vertical scroller */ | ||||
| if (scroll & V2D_SCROLL_LEFT) { | if (scroll & V2D_SCROLL_LEFT) { | ||||
| /* on left-hand edge of region */ | /* on left-hand edge of region */ | ||||
| v2d->vert = *mask_scroll; | v2d->vert = *mask_scroll; | ||||
| v2d->vert.xmax = scroll_width; | v2d->vert.xmax = scroll_width; | ||||
| } | } | ||||
| else if (scroll & V2D_SCROLL_RIGHT) { | else if (scroll & V2D_SCROLL_RIGHT) { | ||||
| Show All 16 Lines | if (scroll & V2D_SCROLL_BOTTOM) { | ||||
| v2d->hor = *mask_scroll; | v2d->hor = *mask_scroll; | ||||
| v2d->hor.ymax = scroll_height; | v2d->hor.ymax = scroll_height; | ||||
| } | } | ||||
| else if (scroll & V2D_SCROLL_TOP) { | else if (scroll & V2D_SCROLL_TOP) { | ||||
| /* on upper edge of region */ | /* on upper edge of region */ | ||||
| v2d->hor = *mask_scroll; | v2d->hor = *mask_scroll; | ||||
| v2d->hor.ymin = v2d->hor.ymax - scroll_height; | v2d->hor.ymin = v2d->hor.ymax - scroll_height; | ||||
| } | } | ||||
| /* adjust vertical scroller if there's a horizontal scroller, to leave corner free */ | |||||
| if (scroll & V2D_SCROLL_VERTICAL) { | |||||
| if (scroll & V2D_SCROLL_BOTTOM) { | |||||
| /* on bottom edge of region */ | |||||
| v2d->vert.ymin = v2d->hor.ymax; | |||||
| } | |||||
| else if (scroll & V2D_SCROLL_TOP) { | |||||
| /* on upper edge of region */ | |||||
| v2d->vert.ymax = v2d->hor.ymin; | |||||
| } | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name View2D Refresh and Validation (Spatial) | /** \name View2D Refresh and Validation (Spatial) | ||||
| * \{ */ | * \{ */ | ||||
| ▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | switch (type) { | ||||
| case V2D_COMMONVIEW_LIST: { | case V2D_COMMONVIEW_LIST: { | ||||
| /* zoom + aspect ratio are locked */ | /* zoom + aspect ratio are locked */ | ||||
| v2d->keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT); | v2d->keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT); | ||||
| v2d->minzoom = v2d->maxzoom = 1.0f; | v2d->minzoom = v2d->maxzoom = 1.0f; | ||||
| /* tot rect has strictly regulated placement, and must only occur in +/- quadrant */ | /* tot rect has strictly regulated placement, and must only occur in +/- quadrant */ | ||||
| v2d->align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y); | v2d->align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_POS_Y); | ||||
| v2d->keeptot = V2D_KEEPTOT_STRICT; | v2d->keeptot = V2D_KEEPTOT_STRICT; | ||||
| v2d->keepofs = (V2D_KEEPOFS_X | V2D_KEEPOFS_Y); | |||||
| tot_changed = do_init; | tot_changed = do_init; | ||||
| /* scroller settings are currently not set here... that is left for regions... */ | /* scroller settings are currently not set here... that is left for regions... */ | ||||
| break; | break; | ||||
| } | } | ||||
| /* 'stack view' - practically the same as list/channel view, | /* 'stack view' - practically the same as list/channel view, | ||||
| * except is located in the pos y half instead. | * except is located in the pos y half instead. | ||||
| * Zoom, aspect ratio, and alignment restrictions are set here. */ | * Zoom, aspect ratio, and alignment restrictions are set here. */ | ||||
| case V2D_COMMONVIEW_STACK: { | case V2D_COMMONVIEW_STACK: { | ||||
| /* zoom + aspect ratio are locked */ | /* zoom + aspect ratio are locked */ | ||||
| v2d->keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT); | v2d->keepzoom = (V2D_LOCKZOOM_X | V2D_LOCKZOOM_Y | V2D_LIMITZOOM | V2D_KEEPASPECT); | ||||
| v2d->minzoom = v2d->maxzoom = 1.0f; | v2d->minzoom = v2d->maxzoom = 1.0f; | ||||
| /* tot rect has strictly regulated placement, and must only occur in +/+ quadrant */ | /* tot rect has strictly regulated placement, and must only occur in +/+ quadrant */ | ||||
| v2d->align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y); | v2d->align = (V2D_ALIGN_NO_NEG_X | V2D_ALIGN_NO_NEG_Y); | ||||
| v2d->keeptot = V2D_KEEPTOT_STRICT; | v2d->keeptot = V2D_KEEPTOT_STRICT; | ||||
| v2d->keepofs = (V2D_KEEPOFS_X | V2D_KEEPOFS_Y); | |||||
| tot_changed = do_init; | tot_changed = do_init; | ||||
| /* scroller settings are currently not set here... that is left for regions... */ | /* scroller settings are currently not set here... that is left for regions... */ | ||||
| break; | break; | ||||
| } | } | ||||
| /* 'header' regions - zoom, aspect ratio, | /* 'header' regions - zoom, aspect ratio, | ||||
| * alignment, and panning restrictions are set here */ | * alignment, and panning restrictions are set here */ | ||||
| case V2D_COMMONVIEW_HEADER: { | case V2D_COMMONVIEW_HEADER: { | ||||
| ▲ Show 20 Lines • Show All 201 Lines • ▼ Show 20 Lines | static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize) | ||||
| else { | else { | ||||
| /* make sure sizes don't exceed that of the min/max sizes | /* make sure sizes don't exceed that of the min/max sizes | ||||
| * (even though we're not doing zoom clamping) */ | * (even though we're not doing zoom clamping) */ | ||||
| CLAMP(width, v2d->min[0], v2d->max[0]); | CLAMP(width, v2d->min[0], v2d->max[0]); | ||||
| CLAMP(height, v2d->min[1], v2d->max[1]); | CLAMP(height, v2d->min[1], v2d->max[1]); | ||||
| } | } | ||||
| /* check if we should restore aspect ratio (if view size changed) */ | /* check if we should restore aspect ratio (if view size changed) */ | ||||
| if (v2d->keepzoom & V2D_KEEPASPECT) { | if (v2d->keepzoom & V2D_KEEPASPECT && !(v2d->keeptot == V2D_KEEPTOT_STRICT)) { | ||||
| bool do_x = false, do_y = false, do_cur /* , do_win */ /* UNUSED */; | bool do_x = false, do_y = false, do_cur; | ||||
| float curRatio, winRatio; | float curRatio, winRatio; | ||||
| /* when a window edge changes, the aspect ratio can't be used to | /* when a window edge changes, the aspect ratio can't be used to | ||||
| * find which is the best new 'cur' rect. that's why it stores 'old' | * find which is the best new 'cur' rect. that's why it stores 'old' | ||||
| */ | */ | ||||
| if (winx != v2d->oldwinx) { | if (winx != v2d->oldwinx) { | ||||
| do_x = true; | do_x = true; | ||||
| } | } | ||||
| Show All 21 Lines | if (do_x == do_y) { | ||||
| else { | else { | ||||
| do_x = true; | do_x = true; | ||||
| } | } | ||||
| } | } | ||||
| do_cur = do_x; | do_cur = do_x; | ||||
| /* do_win = do_y; */ /* UNUSED */ | /* do_win = do_y; */ /* UNUSED */ | ||||
| if (do_cur) { | if (do_cur) { | ||||
| if ((v2d->keeptot == V2D_KEEPTOT_STRICT) && (winx != v2d->oldwinx)) { | |||||
| /* Special exception for Outliner (and later channel-lists): | |||||
| * - The view may be moved left to avoid contents | |||||
| * being pushed out of view when view shrinks. | |||||
| * - The keeptot code will make sure cur->xmin will not be less than tot->xmin | |||||
| * (which cannot be allowed). | |||||
| * - width is not adjusted for changed ratios here. | |||||
| */ | |||||
| if (winx < v2d->oldwinx) { | |||||
| const float temp = v2d->oldwinx - winx; | |||||
| cur->xmin -= temp; | |||||
| cur->xmax -= temp; | |||||
| /* width does not get modified, as keepaspect here is just set to make | |||||
| * sure visible area adjusts to changing view shape! | |||||
| */ | |||||
| } | |||||
| } | |||||
| else { | |||||
| /* portrait window: correct for x */ | /* portrait window: correct for x */ | ||||
| width = height / winRatio; | width = height / winRatio; | ||||
| } | } | ||||
| } | |||||
| else { | |||||
| if ((v2d->keeptot == V2D_KEEPTOT_STRICT) && (winy != v2d->oldwiny)) { | |||||
| /* special exception for Outliner (and later channel-lists): | |||||
| * - Currently, no actions need to be taken here... | |||||
| */ | |||||
| if (winy < v2d->oldwiny) { | |||||
| const float temp = v2d->oldwiny - winy; | |||||
| if (v2d->align & V2D_ALIGN_NO_NEG_Y) { | |||||
| cur->ymin -= temp; | |||||
| cur->ymax -= temp; | |||||
| } | |||||
| else { /* Assume V2D_ALIGN_NO_POS_Y or combination */ | |||||
| cur->ymin += temp; | |||||
| cur->ymax += temp; | |||||
| } | |||||
| } | |||||
| } | |||||
| else { | else { | ||||
| /* landscape window: correct for y */ | /* landscape window: correct for y */ | ||||
| height = width * winRatio; | height = width * winRatio; | ||||
| } | } | ||||
| } | |||||
| /* store region size for next time */ | /* store region size for next time */ | ||||
| v2d->oldwinx = (short)winx; | v2d->oldwinx = (short)winx; | ||||
| v2d->oldwiny = (short)winy; | v2d->oldwiny = (short)winy; | ||||
| } | } | ||||
| /* Step 2: apply new sizes to cur rect, | /* Step 2: apply new sizes to cur rect, | ||||
| * but need to take into account alignment settings here... */ | * but need to take into account alignment settings here... */ | ||||
| ▲ Show 20 Lines • Show All 914 Lines • ▼ Show 20 Lines | if ((r_scrollers->vert_max - r_scrollers->vert_min) < V2D_SCROLL_THUMB_SIZE_MIN) { | ||||
| r_scrollers->vert_max = r_scrollers->vert_min + V2D_SCROLL_THUMB_SIZE_MIN; | r_scrollers->vert_max = r_scrollers->vert_min + V2D_SCROLL_THUMB_SIZE_MIN; | ||||
| CLAMP(r_scrollers->vert_max, vert.ymin + V2D_SCROLL_THUMB_SIZE_MIN, vert.ymax); | CLAMP(r_scrollers->vert_max, vert.ymin + V2D_SCROLL_THUMB_SIZE_MIN, vert.ymax); | ||||
| CLAMP(r_scrollers->vert_min, vert.ymin, vert.ymax - V2D_SCROLL_THUMB_SIZE_MIN); | CLAMP(r_scrollers->vert_min, vert.ymin, vert.ymax - V2D_SCROLL_THUMB_SIZE_MIN); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void UI_view2d_scrollers_draw(View2D *v2d, const rcti *mask_custom) | void UI_view2d_scrollers_draw_ex(View2D *v2d, const rcti *mask_custom, bool use_full_hide) | ||||
| { | { | ||||
| View2DScrollers scrollers; | View2DScrollers scrollers; | ||||
| UI_view2d_scrollers_calc(v2d, mask_custom, &scrollers); | UI_view2d_scrollers_calc(v2d, mask_custom, &scrollers); | ||||
| bTheme *btheme = UI_GetTheme(); | bTheme *btheme = UI_GetTheme(); | ||||
| rcti vert, hor; | rcti vert, hor; | ||||
| const int scroll = view2d_scroll_mapped(v2d->scroll); | const int scroll = view2d_scroll_mapped(v2d->scroll); | ||||
| const char emboss_alpha = btheme->tui.widget_emboss[3]; | const char emboss_alpha = btheme->tui.widget_emboss[3]; | ||||
| const float alpha_min = use_full_hide ? 0.0f : V2D_SCROLL_MIN_ALPHA; | |||||
| uchar scrollers_back_color[4]; | uchar scrollers_back_color[4]; | ||||
| /* Color for scrollbar backs */ | /* Color for scrollbar backs */ | ||||
| UI_GetThemeColor4ubv(TH_BACK, scrollers_back_color); | UI_GetThemeColor4ubv(TH_BACK, scrollers_back_color); | ||||
| /* make copies of rects for less typing */ | /* make copies of rects for less typing */ | ||||
| vert = scrollers.vert; | vert = scrollers.vert; | ||||
| hor = scrollers.hor; | hor = scrollers.hor; | ||||
| /* horizontal scrollbar */ | /* horizontal scrollbar */ | ||||
| if (scroll & V2D_SCROLL_HORIZONTAL) { | if (scroll & V2D_SCROLL_HORIZONTAL) { | ||||
| uiWidgetColors wcol = btheme->tui.wcol_scroll; | uiWidgetColors wcol = btheme->tui.wcol_scroll; | ||||
| const float alpha_fac = v2d->alpha_hor / 255.0f; | /* 0..255 -> min...1 */ | ||||
| const float alpha_fac = ((v2d->alpha_hor / 255.0f) * (1.0f - alpha_min)) + alpha_min; | |||||
| rcti slider; | rcti slider; | ||||
| int state; | int state; | ||||
| slider.xmin = scrollers.hor_min; | slider.xmin = scrollers.hor_min; | ||||
| slider.xmax = scrollers.hor_max; | slider.xmax = scrollers.hor_max; | ||||
| slider.ymin = hor.ymin; | slider.ymin = hor.ymin; | ||||
| slider.ymax = hor.ymax; | slider.ymax = hor.ymax; | ||||
| state = (v2d->scroll_ui & V2D_SCROLL_H_ACTIVE) ? UI_SCROLL_PRESSED : 0; | state = (v2d->scroll_ui & V2D_SCROLL_H_ACTIVE) ? UI_SCROLL_PRESSED : 0; | ||||
| wcol.inner[3] *= alpha_fac; | wcol.inner[3] *= alpha_fac; | ||||
| wcol.item[3] *= alpha_fac; | wcol.item[3] *= alpha_fac; | ||||
| wcol.outline[3] *= alpha_fac; | wcol.outline[3] = 0; | ||||
| btheme->tui.widget_emboss[3] *= alpha_fac; /* will be reset later */ | btheme->tui.widget_emboss[3] = 0; /* will be reset later */ | ||||
| /* show zoom handles if: | /* show zoom handles if: | ||||
| * - zooming on x-axis is allowed (no scroll otherwise) | * - zooming on x-axis is allowed (no scroll otherwise) | ||||
| * - slider bubble is large enough (no overdraw confusion) | * - slider bubble is large enough (no overdraw confusion) | ||||
| * - scale is shown on the scroller | * - scale is shown on the scroller | ||||
| * (workaround to make sure that button windows don't show these, | * (workaround to make sure that button windows don't show these, | ||||
| * and only the time-grids with their zoom-ability can do so). | * and only the time-grids with their zoom-ability can do so). | ||||
| */ | */ | ||||
| if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0 && (v2d->scroll & V2D_SCROLL_HORIZONTAL_HANDLES) && | if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0 && (v2d->scroll & V2D_SCROLL_HORIZONTAL_HANDLES) && | ||||
| (BLI_rcti_size_x(&slider) > V2D_SCROLL_HANDLE_SIZE_HOTSPOT)) { | (BLI_rcti_size_x(&slider) > V2D_SCROLL_HANDLE_SIZE_HOTSPOT)) { | ||||
| state |= UI_SCROLL_ARROWS; | state |= UI_SCROLL_ARROWS; | ||||
| } | } | ||||
| UI_draw_widget_scroll(&wcol, &hor, &slider, state); | UI_draw_widget_scroll(&wcol, &hor, &slider, state); | ||||
| } | } | ||||
| /* vertical scrollbar */ | /* vertical scrollbar */ | ||||
| if (scroll & V2D_SCROLL_VERTICAL) { | if (scroll & V2D_SCROLL_VERTICAL) { | ||||
| uiWidgetColors wcol = btheme->tui.wcol_scroll; | uiWidgetColors wcol = btheme->tui.wcol_scroll; | ||||
| rcti slider; | rcti slider; | ||||
| const float alpha_fac = v2d->alpha_vert / 255.0f; | /* 0..255 -> min...1 */ | ||||
| const float alpha_fac = ((v2d->alpha_vert / 255.0f) * (1.0f - alpha_min)) + alpha_min; | |||||
| int state; | int state; | ||||
| slider.xmin = vert.xmin; | slider.xmin = vert.xmin; | ||||
| slider.xmax = vert.xmax; | slider.xmax = vert.xmax; | ||||
| slider.ymin = scrollers.vert_min; | slider.ymin = scrollers.vert_min; | ||||
| slider.ymax = scrollers.vert_max; | slider.ymax = scrollers.vert_max; | ||||
| state = (v2d->scroll_ui & V2D_SCROLL_V_ACTIVE) ? UI_SCROLL_PRESSED : 0; | state = (v2d->scroll_ui & V2D_SCROLL_V_ACTIVE) ? UI_SCROLL_PRESSED : 0; | ||||
| wcol.inner[3] *= alpha_fac; | wcol.inner[3] *= alpha_fac; | ||||
| wcol.item[3] *= alpha_fac; | wcol.item[3] *= alpha_fac; | ||||
| wcol.outline[3] *= alpha_fac; | wcol.outline[3] = 0; | ||||
| btheme->tui.widget_emboss[3] *= alpha_fac; /* will be reset later */ | btheme->tui.widget_emboss[3] = 0; /* will be reset later */ | ||||
| /* show zoom handles if: | /* show zoom handles if: | ||||
| * - zooming on y-axis is allowed (no scroll otherwise) | * - zooming on y-axis is allowed (no scroll otherwise) | ||||
| * - slider bubble is large enough (no overdraw confusion) | * - slider bubble is large enough (no overdraw confusion) | ||||
| * - scale is shown on the scroller | * - scale is shown on the scroller | ||||
| * (workaround to make sure that button windows don't show these, | * (workaround to make sure that button windows don't show these, | ||||
| * and only the time-grids with their zoomability can do so) | * and only the time-grids with their zoomability can do so) | ||||
| */ | */ | ||||
| if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0 && (v2d->scroll & V2D_SCROLL_VERTICAL_HANDLES) && | if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0 && (v2d->scroll & V2D_SCROLL_VERTICAL_HANDLES) && | ||||
| (BLI_rcti_size_y(&slider) > V2D_SCROLL_HANDLE_SIZE_HOTSPOT)) { | (BLI_rcti_size_y(&slider) > V2D_SCROLL_HANDLE_SIZE_HOTSPOT)) { | ||||
| state |= UI_SCROLL_ARROWS; | state |= UI_SCROLL_ARROWS; | ||||
| } | } | ||||
| UI_draw_widget_scroll(&wcol, &vert, &slider, state); | UI_draw_widget_scroll(&wcol, &vert, &slider, state); | ||||
| } | } | ||||
| /* Was changed above, so reset. */ | /* Was changed above, so reset. */ | ||||
| btheme->tui.widget_emboss[3] = emboss_alpha; | btheme->tui.widget_emboss[3] = emboss_alpha; | ||||
| } | } | ||||
| void UI_view2d_scrollers_draw(View2D *v2d, const rcti *mask_custom) | |||||
| { | |||||
| UI_view2d_scrollers_draw_ex(v2d, mask_custom, false); | |||||
| } | |||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name List View Utilities | /** \name List View Utilities | ||||
| * \{ */ | * \{ */ | ||||
| void UI_view2d_listview_view_to_cell(float columnwidth, | void UI_view2d_listview_view_to_cell(float columnwidth, | ||||
| float rowheight, | float rowheight, | ||||
| ▲ Show 20 Lines • Show All 220 Lines • ▼ Show 20 Lines | View2D *UI_view2d_fromcontext_rwin(const bContext *C) | ||||
| } | } | ||||
| if (region->regiontype != RGN_TYPE_WINDOW) { | if (region->regiontype != RGN_TYPE_WINDOW) { | ||||
| ARegion *region_win = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); | ARegion *region_win = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); | ||||
| return region_win ? &(region_win->v2d) : nullptr; | return region_win ? &(region_win->v2d) : nullptr; | ||||
| } | } | ||||
| return &(region->v2d); | return &(region->v2d); | ||||
| } | } | ||||
| void UI_view2d_scroller_size_get(const View2D *v2d, float *r_x, float *r_y) | void UI_view2d_scroller_size_get(const View2D *v2d, bool mapped, float *r_x, float *r_y) | ||||
| { | { | ||||
| const int scroll = view2d_scroll_mapped(v2d->scroll); | const int scroll = (mapped) ? view2d_scroll_mapped(v2d->scroll) : v2d->scroll; | ||||
| if (r_x) { | if (r_x) { | ||||
| if (scroll & V2D_SCROLL_VERTICAL) { | if (scroll & V2D_SCROLL_VERTICAL) { | ||||
| *r_x = (scroll & V2D_SCROLL_VERTICAL_HANDLES) ? V2D_SCROLL_HANDLE_WIDTH : V2D_SCROLL_WIDTH; | *r_x = (scroll & V2D_SCROLL_VERTICAL_HANDLES) ? V2D_SCROLL_HANDLE_WIDTH : V2D_SCROLL_WIDTH; | ||||
| *r_x = ((*r_x - V2D_SCROLL_MIN_WIDTH) * (v2d->alpha_vert / 255.0f)) + V2D_SCROLL_MIN_WIDTH; | |||||
| } | } | ||||
| else { | else { | ||||
| *r_x = 0; | *r_x = 0; | ||||
| } | } | ||||
| } | } | ||||
| if (r_y) { | if (r_y) { | ||||
| if (scroll & V2D_SCROLL_HORIZONTAL) { | if (scroll & V2D_SCROLL_HORIZONTAL) { | ||||
| *r_y = (scroll & V2D_SCROLL_HORIZONTAL_HANDLES) ? V2D_SCROLL_HANDLE_HEIGHT : | *r_y = (scroll & V2D_SCROLL_HORIZONTAL_HANDLES) ? V2D_SCROLL_HANDLE_HEIGHT : | ||||
| V2D_SCROLL_HEIGHT; | V2D_SCROLL_HEIGHT; | ||||
| *r_y = ((*r_y - V2D_SCROLL_MIN_WIDTH) * (v2d->alpha_hor / 255.0f)) + V2D_SCROLL_MIN_WIDTH; | |||||
| } | } | ||||
| else { | else { | ||||
| *r_y = 0; | *r_y = 0; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void UI_view2d_scale_get(const View2D *v2d, float *r_x, float *r_y) | void UI_view2d_scale_get(const View2D *v2d, float *r_x, float *r_y) | ||||
| ▲ Show 20 Lines • Show All 260 Lines • Show Last 20 Lines | |||||