Skip to content

Customize the workspace scrollbar margin #8587

@FranciscoCaetano88

Description

@FranciscoCaetano88

Check for duplicates

  • I have searched for similar issues before opening a new one.

Problem

No response

Request

I want to add a margin to the workspaces scrollbar to create some space between it and the edges of the viewport.

After examining the Blockly code, I discovered that the ScrollbarPair and Scrollbar constructors can accept an optional margin parameter. The issue is that this optional margin isn't being passed to the new ScrollbarPair in the core/inject module.

ScrollbarPair class:
constructor(
private workspace: WorkspaceSvg,
addHorizontal?: boolean,
addVertical?: boolean,
opt_class?: string,
opt_margin?: number,
) {
...
}

core/inject
mainWorkspace.scrollbar = new ScrollbarPair(
mainWorkspace,
horizontalScroll,
verticalScroll,
'blocklyMainWorkspaceScrollbar',
// missing margin
);

A quick fix would be to add this property coming from the scrollbar blockly options.

Alternatives considered

Register a new vertical/horizontal Scrollbar using the registry to override the Scrollbar characteristics or behaviours.
Remove the read only keyword from the static property DEFAULT_SCROLLBAR_MARGIN.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: feature requestDescribes a new feature and why it should be added

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions