Skip to content

Commit d134b0b

Browse files
committed
chore: use the local clamp function instead of redefining it
1 parent c660734 commit d134b0b

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/packages/core/components/split-panel/split-panel.element.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
query,
99
state,
1010
} from '@umbraco-cms/backoffice/external/lit';
11+
import { clamp } from '@umbraco-cms/backoffice/utils';
1112

1213
/**
1314
* Custom element for a split panel with adjustable divider.
@@ -89,13 +90,9 @@ export class UmbSplitPanelElement extends LitElement {
8990
}
9091
}
9192

92-
#clamp(value: number, min: number, max: number) {
93-
return Math.min(Math.max(value, min), max);
94-
}
95-
9693
#setPosition(pos: number) {
9794
const { width } = this.mainElement.getBoundingClientRect();
98-
const localPos = this.#clamp(pos, 0, width);
95+
const localPos = clamp(pos, 0, width);
9996
const percentagePos = (localPos / width) * 100;
10097
this.position = percentagePos + '%';
10198
}
@@ -127,7 +124,7 @@ export class UmbSplitPanelElement extends LitElement {
127124
const move = (event: PointerEvent) => {
128125
const { clientX } = event;
129126
const { left, width } = this.mainElement.getBoundingClientRect();
130-
const localPos = this.#clamp(clientX - left, 0, width);
127+
const localPos = clamp(clientX - left, 0, width);
131128
const mappedPos = mapXAxisToSnap(localPos, width);
132129

133130
this.#lockedPanelWidth = this.lock === 'start' ? mappedPos : width - mappedPos;

src/packages/core/temporary-file/components/temporary-file-badge.element.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { css, customElement, html, property } from '@umbraco-cms/backoffice/external/lit';
22
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
3-
import { clamp } from '@umbraco-cms/backoffice/external/uui';
3+
import { clamp } from '@umbraco-cms/backoffice/utils';
44

55
@customElement('umb-temporary-file-badge')
66
export class UmbTemporaryFileBadgeElement extends UmbLitElement {

0 commit comments

Comments
 (0)