|
@@ -137,19 +137,27 @@ export const Slider = React.forwardRef<SliderDerivedElement, SliderProps>(({ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const {current: slider} = ref; |
|
|
const {current: slider} = ref; |
|
|
|
|
|
const parent = slider?.parentElement as HTMLElement; |
|
|
|
|
|
const grandParent = parent?.parentElement as HTMLElement; |
|
|
|
|
|
|
|
|
const isNotFirefox = browser !== 'firefox'; |
|
|
const isNotFirefox = browser !== 'firefox'; |
|
|
if (isNotFirefox && orient === 'vertical' && slider) { |
|
|
|
|
|
const parent = slider.parentElement as HTMLElement; |
|
|
|
|
|
const grandParent = parent.parentElement as HTMLElement; |
|
|
|
|
|
const trueHeight = slider!.parentElement!.clientWidth; |
|
|
|
|
|
const trueWidth = slider!.parentElement!.clientHeight; |
|
|
|
|
|
|
|
|
const shouldEffectExecute = isNotFirefox && orient === 'vertical' && slider && parent && grandParent; |
|
|
|
|
|
if (shouldEffectExecute) { |
|
|
|
|
|
const trueHeight = parent.clientWidth; |
|
|
|
|
|
const trueWidth = parent.clientHeight; |
|
|
|
|
|
|
|
|
|
|
|
grandParent.dataset.height = grandParent.clientHeight.toString(); |
|
|
|
|
|
grandParent.dataset.width = grandParent.clientWidth.toString(); |
|
|
grandParent.style.height = trueHeight + 'px'; |
|
|
grandParent.style.height = trueHeight + 'px'; |
|
|
grandParent.style.width = trueWidth + 'px'; |
|
|
grandParent.style.width = trueWidth + 'px'; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return () => { |
|
|
return () => { |
|
|
if (slider && isNotFirefox) { |
|
|
|
|
|
|
|
|
if (shouldEffectExecute) { |
|
|
|
|
|
grandParent.style.height = grandParent.dataset.height + 'px'; |
|
|
|
|
|
grandParent.style.width = grandParent.dataset.width + 'px'; |
|
|
|
|
|
grandParent.removeAttribute('data-height'); |
|
|
|
|
|
grandParent.removeAttribute('data-width'); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
}, [ref, orient, browser]); |
|
|
}, [ref, orient, browser]); |
|
|