旋转拖拽条添加点击事件

uat_us
caiyiling 2024-03-26 14:38:13 +08:00
parent 956e3b7152
commit d74a4506c9
1 changed files with 10 additions and 10 deletions

View File

@ -416,7 +416,7 @@ export default {
const sliderWidth = slider.offsetWidth const sliderWidth = slider.offsetWidth
const maxX = containerWidth - sliderWidth const maxX = containerWidth - sliderWidth
const { direction } = wheel const { direction } = wheel
console.log(containerWidth - sliderWidth)
var x = Math.trunc(30 * ((containerWidth - sliderWidth) / 360)) var x = Math.trunc(30 * ((containerWidth - sliderWidth) / 360))
if (direction > 0 && (this.rotateBarLeft + x) > maxX) { if (direction > 0 && (this.rotateBarLeft + x) > maxX) {
this.rotateBarLeft = x - (containerWidth - sliderWidth - this.rotateBarLeft) this.rotateBarLeft = x - (containerWidth - sliderWidth - this.rotateBarLeft)
@ -483,15 +483,15 @@ export default {
}, },
clickRotate(e) { clickRotate(e) {
// console.log('clickRotate') // console.log('clickRotate')
// const container = document.getElementById('rotateBar') const container = document.getElementById('rotateBar')
// const containerWidth = container.offsetWidth const containerWidth = container.offsetWidth
// const slider = document.getElementById('rotateSlider') const slider = document.getElementById('rotateSlider')
// const sliderWidth = slider.offsetWidth const sliderWidth = slider.offsetWidth
// const x = e.clientX - this.rotateBarInfo.initX + this.rotateBarInfo.initLeft const x = Math.trunc(e.offsetX)
// const deltaX = x - this.rotateBarLeft const deltaX = x - this.rotateBarLeft
// const angle = Math.sin((deltaX * (360 / (containerWidth - sliderWidth))) * Math.PI / 180) const angle = Math.sin((deltaX * (360 / (containerWidth - sliderWidth))) * Math.PI / 180)
// this.rotate(angle) this.rotate(angle)
// this.rotateBarLeft = x this.rotateBarLeft = x
}, },
scroll(index) { scroll(index) {
renderingEngine = getRenderingEngine(this.renderingEngineId) renderingEngine = getRenderingEngine(this.renderingEngineId)