This repository has been archived on 2023-08-30. You can view files and clone it, but cannot push or open issues/pull-requests.
bytedo
/
wcui
Archived
1
0
Fork 0

修复drag插件,dragged回调的bug

old
宇天 2017-09-13 16:51:15 +08:00
parent 6f3979dfd4
commit f1f365e6e4
2 changed files with 9 additions and 9 deletions

View File

@ -35,9 +35,9 @@
<script src="/js/yua.js"></script> <script src="/js/yua.js"></script>
<script> <script>
require(['tool/drag/drag.min'], function(){ require(['lib/drag/main'], function(){
yua.define({ yua({
$id: 'test' $id: 'test'
}) })
yua.scan() yua.scan()
@ -67,12 +67,12 @@
<div class="handle" :drag="box"></div> <div class="handle" :drag="box"></div>
</div> </div>
<script src="/js/yua.js"></script>
<script> <script>
require(['tool/drag/drag.min'], function(){ require(['lib/drag/main'], function(){
yua.define({ yua({
$id: 'test' $id: 'test'
}) })
yua.scan() yua.scan()

View File

@ -19,7 +19,7 @@ define(['yua'], function(){
} }
} }
} }
yua.ui.drag = '0.0.1' yua.ui.drag = '1.0.0'
// 元素拖动 // 元素拖动
yua.directive('drag', { yua.directive('drag', {
priority: 1500, priority: 1500,
@ -82,7 +82,7 @@ define(['yua'], function(){
} }
var dx,dy,mx,my,ox,oy,tw,th,ww,wh,bst,bsl; var dx,dy,mx,my,ox,oy,fox,foy,tw,th,ww,wh,bst,bsl;
$drag.bind('mousedown', function(ev){ $drag.bind('mousedown', function(ev){
var gcs = getComputedStyle(target), var gcs = getComputedStyle(target),
cst = gcs.transform.replace(/matrix\((.*)\)/, '$1'), cst = gcs.transform.replace(/matrix\((.*)\)/, '$1'),
@ -148,8 +148,8 @@ define(['yua'], function(){
} }
var fox = ox + cst[4], //修正的offset fox = ox + cst[4], //修正的offset
foy = oy + cst[5]; //修正的offset foy = oy + cst[5]; //修正的offset
//如果不允许溢出可视区 //如果不允许溢出可视区