# movable-view

Start from base library version 1.2.0. Please remaining backward compatible.

A removable view container that can be dragged and slid across the page.movable-view must be in the movable-area Component and must be a direct child node, otherwise it cannot be moved.

attribute type Default value Required Introductions Minimum version
direction string none no The moveable - view direction of movement, with attributes such as all, vertical, horizontal, none 1.2.0
inertia boolean false no Moveable - view with inertia 1.2.0
out-of-bounds boolean false no Can movable-view move after exceeding the movable area 1.2.0
x number/string no Defines the offset in the x-axis direction. If the value of x is not in the movable range, it will automatically move to the movableChanging the value of x triggers animationUnit support px (default), rpx 1.2.0
and number/string no Defines an offset in the y direction, which is automatically moved if the value of y is not in the moveable rangeChanging the value of y triggers the animationUnit support px (default), rpx 1.2.0
damping number 20 no Damping factor, used to control x or y changes in animation and bounce-back animation, the greater the value, the faster it moves 1.2.0
friction number 2 no Coefficient of friction, used to control the animation of inertial sliding, the greater the value of the friction, the faster the sliding stopsMust be greater than 0 or it will be set to default 1.2.0
disabled boolean false no Is it disabled? 1.9.90
scale boolean false no Dual finger zoom is supported. The default area for zoom gestures is within movable-view 1.9.90
scale-min number 0.5 no Define minimum zoom 1.9.90
scale-max number 10 no Define maximum scaling factor 1.9.90
scale-value number 1 no Defines the scaling factor, which has a range of values 0.5 - 10 1.9.90
animation boolean true no Whether to use animation 2.1.0
bindchange eventhandle no Event triggered during drag, event. detail = {x, and source} 1.9.90
bindscale eventhandle no Event triggered during scaling, event.detail = {x, and Scale}, x and y fields in [Support after 2.1.0%} {% version(1.9.90]((compatibility))
htouchmove eventhandle no Triggered when the first finger touch moves laterally. If this event is caught, it means the touchmove event is also caught. 1.9.90
vtouchmove eventhandle no Triggered when the movement is longitudinal after the first finger touch. If the event is caught, it means the touchmove event is also caught 1.9.90

# bindchange Returned source Indicates the cause of the movement

value Introductions
touch to drag
touch-out-of-bounds Out of range.
out-of-bounds Rebound after moving out of range
friction inertia
Empty string setData

# Bug & Tip

  1. tip: movable-view The width and height properties must be set, not set to default to 10px
  2. tip: movable-view The default is absolute positioning and the top and left attributes are 0px