滚动组件增加滚动轴配置
							parent
							
								
									940f9acec8
								
							
						
					
					
						commit
						b83c247a02
					
				| 
						 | 
					@ -214,7 +214,6 @@ export default class Scroll {
 | 
				
			||||||
      this.props.xw = xw
 | 
					      this.props.xw = xw
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.__X__.style.width = xw + 'px'
 | 
					      this.__X__.style.width = xw + 'px'
 | 
				
			||||||
 | 
					 | 
				
			||||||
      this.__Y__.style.height = yh + 'px'
 | 
					      this.__Y__.style.height = yh + 'px'
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -247,24 +246,30 @@ export default class Scroll {
 | 
				
			||||||
          deltaY = ev.deltaY / (delta / 120)
 | 
					          deltaY = ev.deltaY / (delta / 120)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					      if (this.props.axis !== 'x') {
 | 
				
			||||||
 | 
					        this.__BOX__.scrollTop += deltaY
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      this.__BOX__.scrollTop += deltaY
 | 
					        if (yh) {
 | 
				
			||||||
      this.__BOX__.scrollLeft += deltaX
 | 
					          // 修正滚动条的位置
 | 
				
			||||||
 | 
					          // 滚动比例 y 滚动条的可移动距离
 | 
				
			||||||
 | 
					          var fixedY = (this.__BOX__.scrollTop / (sh - oh)) * (oh - yh)
 | 
				
			||||||
 | 
					          this.props.thumbY = fixedY
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (xw) {
 | 
					          this.__Y__.style.transform = `translateY(${fixedY}px)`
 | 
				
			||||||
        // 修正滚动条的位置
 | 
					        }
 | 
				
			||||||
        // 滚动比例 x 滚动条的可移动距离
 | 
					 | 
				
			||||||
        var fixedX = (this.__BOX__.scrollLeft / (sw - ow)) * (ow - xw)
 | 
					 | 
				
			||||||
        this.props.thumbX = fixedX
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        this.__X__.style.transform = `translateX(${fixedX}px)`
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if (yh) {
 | 
					      if (this.props.axis !== 'y') {
 | 
				
			||||||
        var fixedY = (this.__BOX__.scrollTop / (sh - oh)) * (oh - yh)
 | 
					        this.__BOX__.scrollLeft += deltaX
 | 
				
			||||||
        this.props.thumbY = fixedY
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        this.__Y__.style.transform = `translateY(${fixedY}px)`
 | 
					        if (xw) {
 | 
				
			||||||
 | 
					          // 修正滚动条的位置
 | 
				
			||||||
 | 
					          // 滚动比例 x 滚动条的可移动距离
 | 
				
			||||||
 | 
					          var fixedX = (this.__BOX__.scrollLeft / (sw - ow)) * (ow - xw)
 | 
				
			||||||
 | 
					          this.props.thumbX = fixedX
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          this.__X__.style.transform = `translateX(${fixedX}px)`
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in New Issue