Stay organized with collections
Save and categorize content based on your preferences.
blockly > Scrollbar
Class for a pure SVG scrollbar. This technique offers a scrollbar that is guaranteed to work, but may not look or behave like the system's scrollbars.
Signature:
export declare class Scrollbar
Constructors
Properties
Methods
Method |
Modifiers |
Description |
dispose() |
|
Dispose of this scrollbar. Remove DOM elements, event listeners, and theme subscriptions. |
isVisible() |
|
Is the scrollbar visible. Non-paired scrollbars disappear when they aren't needed. |
resize(opt_metrics) |
|
Recalculate the scrollbar's location and its length. |
resizeContentHorizontal(hostMetrics) |
|
Recalculate a horizontal scrollbar's location within its path and length. This should be called when the contents of the workspace have changed. |
resizeContentVertical(hostMetrics) |
|
Recalculate a vertical scrollbar's location within its path and length. This should be called when the contents of the workspace have changed. |
resizeViewHorizontal(hostMetrics) |
|
Recalculate a horizontal scrollbar's location on the screen and path length. This should be called when the layout or size of the window has changed. |
resizeViewVertical(hostMetrics) |
|
Recalculate a vertical scrollbar's location on the screen and path length. This should be called when the layout or size of the window has changed. |
set(value, updateMetrics) |
|
Set the scrollbar handle's position. |
setContainerVisible(visible) |
|
Set whether the scrollbar's container is visible and update display accordingly if visibility has changed. |
setHandlePosition(newPosition) |
|
Set the offset of the scrollbar's handle from the scrollbar's position, and change the SVG attribute accordingly. |
setOrigin(x, y) |
|
Record the origin of the workspace that the scrollbar is in, in pixels relative to the injection div origin. This is for times when the scrollbar is used in an object whose origin isn't the same as the main workspace (e.g. in a flyout.) |
setVisible(visible) |
|
Set whether the scrollbar is visible. Only applies to non-paired scrollbars. |
updateDisplay_() |
|
Update visibility of scrollbar based on whether it thinks it should be visible and whether its containing workspace is visible. We cannot rely on the containing workspace being hidden to hide us because it is not necessarily our parent in the DOM. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["The `Scrollbar` class creates custom scrollbars using SVG, ensuring functionality across different systems but potentially differing in appearance from native scrollbars."],["It provides methods to control the scrollbar's visibility, position, and size, adapting to content and window changes."],["Scrollbars can be paired or unpaired, with unpaired ones automatically hiding when not needed."],["Properties allow access and modification to scrollbar behavior and appearance through DOM attributes and event handlers."],["Developers can interact with the scrollbar through its methods to dynamically adjust its position, visibility, and responsiveness to workspace content."]]],["The `Scrollbar` class provides a pure SVG scrollbar for workspaces. Key actions include: constructing a scrollbar, setting its visibility, and managing its position. Methods allow recalculating the scrollbar's location and length based on content or window changes (resize). Event handlers manage mouse interactions. Additional functionality includes setting the handle position, updating display visibility, and managing the scrollbar's origin. The class also enables the disposal of the scrollbar and related elements.\n"]]