旋转拖拽条添加点击事件
parent
956e3b7152
commit
d74a4506c9
|
@ -416,7 +416,7 @@ export default {
|
|||
const sliderWidth = slider.offsetWidth
|
||||
const maxX = containerWidth - sliderWidth
|
||||
const { direction } = wheel
|
||||
console.log(containerWidth - sliderWidth)
|
||||
|
||||
var x = Math.trunc(30 * ((containerWidth - sliderWidth) / 360))
|
||||
if (direction > 0 && (this.rotateBarLeft + x) > maxX) {
|
||||
this.rotateBarLeft = x - (containerWidth - sliderWidth - this.rotateBarLeft)
|
||||
|
@ -483,15 +483,15 @@ export default {
|
|||
},
|
||||
clickRotate(e) {
|
||||
// console.log('clickRotate')
|
||||
// const container = document.getElementById('rotateBar')
|
||||
// const containerWidth = container.offsetWidth
|
||||
// const slider = document.getElementById('rotateSlider')
|
||||
// const sliderWidth = slider.offsetWidth
|
||||
// const x = e.clientX - this.rotateBarInfo.initX + this.rotateBarInfo.initLeft
|
||||
// const deltaX = x - this.rotateBarLeft
|
||||
// const angle = Math.sin((deltaX * (360 / (containerWidth - sliderWidth))) * Math.PI / 180)
|
||||
// this.rotate(angle)
|
||||
// this.rotateBarLeft = x
|
||||
const container = document.getElementById('rotateBar')
|
||||
const containerWidth = container.offsetWidth
|
||||
const slider = document.getElementById('rotateSlider')
|
||||
const sliderWidth = slider.offsetWidth
|
||||
const x = Math.trunc(e.offsetX)
|
||||
const deltaX = x - this.rotateBarLeft
|
||||
const angle = Math.sin((deltaX * (360 / (containerWidth - sliderWidth))) * Math.PI / 180)
|
||||
this.rotate(angle)
|
||||
this.rotateBarLeft = x
|
||||
},
|
||||
scroll(index) {
|
||||
renderingEngine = getRenderingEngine(this.renderingEngineId)
|
||||
|
|
Loading…
Reference in New Issue