Class: ScrollbarPair
Defined in: packages/blockly/core/scrollbar_pair.ts:24
Class for a pair of scrollbars. Horizontal and vertical.
Properties index
| Property | Description |
|---|---|
| hScroll | - |
| vScroll | - |
| corner_ | - |
Methods index
| Method | Description |
|---|---|
| dispose | Dispose of this pair of scrollbars. Unlink from all DOM elements to prevent memory leaks. |
| resize | Recalculate both of the scrollbars' locations and lengths. Also reposition the corner rectangle. |
| canScrollHorizontally | Returns whether scrolling horizontally is enabled. |
| canScrollVertically | Returns whether scrolling vertically is enabled. |
| set | Set the handles of both scrollbars. |
| setX | Set the handle of the horizontal scrollbar to be at a certain position in CSS pixels relative to its parents. |
| setY | Set the handle of the vertical scrollbar to be at a certain position in CSS pixels relative to its parents. |
| setContainerVisible | Set whether this scrollbar's container is visible. |
| isVisible | If any of the scrollbars are visible. Non-paired scrollbars may disappear when they aren't needed. |
| setVisible | Sets the visibility of any existing scrollbars. |
| resizeContent | Recalculates the scrollbars' locations within their path and length. This should be called when the contents of the workspace have changed. |
| resizeView | Recalculates the scrollbars' locations on the screen and path length. This should be called when the layout or size of the window has changed. |
Constructors
Constructor
new ScrollbarPair(
workspace,
addHorizontal?,
addVertical?,
opt_class?,
opt_margin?
): ScrollbarPair;
Defined in: packages/blockly/core/scrollbar_pair.ts:40
Parameters
| Parameter | Type | Description |
|---|---|---|
workspace | WorkspaceSvg | Workspace to bind the scrollbars to. |
addHorizontal? | boolean | Whether to add a horizontal scrollbar. Defaults to true. |
addVertical? | boolean | Whether to add a vertical scrollbar. Defaults to true. |
opt_class? | string | A class to be applied to these scrollbars. |
opt_margin? | number | The margin to apply to these scrollbars. |
Returns
ScrollbarPair
Properties
hScroll
hScroll: Scrollbar | null = null;
Defined in: packages/blockly/core/scrollbar_pair.ts:25
vScroll
vScroll: Scrollbar | null = null;
Defined in: packages/blockly/core/scrollbar_pair.ts:26
corner_
corner_: SVGRectElement | null = null;
Defined in: packages/blockly/core/scrollbar_pair.ts:27
Methods
dispose()
dispose(): void;
Defined in: packages/blockly/core/scrollbar_pair.ts:84
Dispose of this pair of scrollbars. Unlink from all DOM elements to prevent memory leaks.
Returns
void
resize()
resize(): void;
Defined in: packages/blockly/core/scrollbar_pair.ts:102
Recalculate both of the scrollbars' locations and lengths. Also reposition the corner rectangle.
Returns
void
canScrollHorizontally()
canScrollHorizontally(): boolean;
Defined in: packages/blockly/core/scrollbar_pair.ts:185
Returns whether scrolling horizontally is enabled.
Returns
boolean
True if horizontal scroll is enabled.
canScrollVertically()
canScrollVertically(): boolean;
Defined in: packages/blockly/core/scrollbar_pair.ts:194
Returns whether scrolling vertically is enabled.
Returns
boolean
True if vertical scroll is enabled.
set()
set(
x,
y,
updateMetrics
): void;
Defined in: packages/blockly/core/scrollbar_pair.ts:226
Set the handles of both scrollbars.
Parameters
| Parameter | Type | Description |
|---|---|---|
x | number | The horizontal content displacement, relative to the view in pixels. |
y | number | The vertical content displacement, relative to the view in pixels. |
updateMetrics | boolean | Whether to update metrics on this set call. Defaults to true. |
Returns
void
setX()
setX(x): void;
Defined in: packages/blockly/core/scrollbar_pair.ts:259
Set the handle of the horizontal scrollbar to be at a certain position in CSS pixels relative to its parents.
Parameters
| Parameter | Type | Description |
|---|---|---|
x | number | Horizontal scroll value. |
Returns
void
setY()
setY(y): void;
Defined in: packages/blockly/core/scrollbar_pair.ts:271
Set the handle of the vertical scrollbar to be at a certain position in CSS pixels relative to its parents.
Parameters
| Parameter | Type | Description |
|---|---|---|
y | number | Vertical scroll value. |
Returns
void
setContainerVisible()
setContainerVisible(visible): void;
Defined in: packages/blockly/core/scrollbar_pair.ts:282
Set whether this scrollbar's container is visible.
Parameters
| Parameter | Type | Description |
|---|---|---|
visible | boolean | Whether the container is visible. |
Returns
void
isVisible()
isVisible(): boolean;
Defined in: packages/blockly/core/scrollbar_pair.ts:297
If any of the scrollbars are visible. Non-paired scrollbars may disappear when they aren't needed.
Returns
boolean
True if visible.
setVisible()
setVisible(visible): void;
Defined in: packages/blockly/core/scrollbar_pair.ts:313
Sets the visibility of any existing scrollbars.
Parameters
| Parameter | Type | Description |
|---|---|---|
visible | boolean | True if visible. |
Returns
void
resizeContent()
resizeContent(hostMetrics): void;
Defined in: packages/blockly/core/scrollbar_pair.ts:325
Recalculates the scrollbars' locations within their path and length. This should be called when the contents of the workspace have changed.
Parameters
| Parameter | Type | Description |
|---|---|---|
hostMetrics | Metrics | A data structure describing all the required dimensions, possibly fetched from the host object. |
Returns
void
resizeView()
resizeView(hostMetrics): void;
Defined in: packages/blockly/core/scrollbar_pair.ts:341
Recalculates the scrollbars' locations on the screen and path length. This should be called when the layout or size of the window has changed.
Parameters
| Parameter | Type | Description |
|---|---|---|
hostMetrics | Metrics | A data structure describing all the required dimensions, possibly fetched from the host object. |
Returns
void