1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-26 01:04:06 +08:00
This commit is contained in:
shylinux 2021-06-02 10:45:56 +08:00
parent b2d33d1991
commit e9fa139546
2 changed files with 8 additions and 1 deletions

View File

@ -677,7 +677,12 @@ Volcanos("onmotion", {help: "动态特效", list: [], _init: function(can, targe
}) })
}, },
move: function(can, target, layout) { var begin move: function(can, target, layout) { var begin
target.onmousedown = function(event) { target.onmousedown = function(event) {
layout.width = target.offsetWidth
layout.height = target.offsetHeight
layout.left = target.offsetLeft
layout.top = target.offsetTop
begin = {x: event.x, y: event.y, left: layout.left, top: layout.top, width: layout.width, height: layout.height} begin = {x: event.x, y: event.y, left: layout.left, top: layout.top, width: layout.width, height: layout.height}
}, target.onmouseup = function(event) { begin = null } }, target.onmouseup = function(event) { begin = null }

View File

@ -156,7 +156,9 @@ Volcanos("ondetail", {help: "用户交互", list: [],
sub.Conf("height", height+120) sub.Conf("height", height+120)
} }
can.page.Modify(can, sub._target, {style: {position: "fixed", left: left+margin, top: top}}) var layout = {position: "fixed", left: left+margin, top: top}
can.onmotion.move(can, sub._target, layout)
can.page.Modify(can, sub._target, {style: layout})
can.page.Modify(can, sub._output, {style: {"max-width": width-margin*2}}) can.page.Modify(can, sub._output, {style: {"max-width": width-margin*2}})
can.base.isFunc(cb) && cb(msg) can.base.isFunc(cb) && cb(msg)
}) })