mirror of
https://github.com/element-plus/element-plus.git
synced 2026-03-13 07:51:17 +08:00
35 lines
720 B
TypeScript
35 lines
720 B
TypeScript
export const BAR_MAP = {
|
|
vertical: {
|
|
offset: 'offsetHeight',
|
|
scroll: 'scrollTop',
|
|
scrollSize: 'scrollHeight',
|
|
size: 'height',
|
|
key: 'vertical',
|
|
axis: 'Y',
|
|
client: 'clientY',
|
|
direction: 'top',
|
|
},
|
|
horizontal: {
|
|
offset: 'offsetWidth',
|
|
scroll: 'scrollLeft',
|
|
scrollSize: 'scrollWidth',
|
|
size: 'width',
|
|
key: 'horizontal',
|
|
axis: 'X',
|
|
client: 'clientX',
|
|
direction: 'left',
|
|
},
|
|
}
|
|
|
|
export function renderThumbStyle({ move, size, bar }) {
|
|
const style = {} as any
|
|
const translate = `translate${bar.axis}(${ move }%)`
|
|
|
|
style[bar.size] = size
|
|
style.transform = translate
|
|
style.msTransform = translate
|
|
style.webkitTransform = translate
|
|
|
|
return style
|
|
}
|