diff --git a/frame.js b/frame.js index 17aabb21..85471134 100644 --- a/frame.js +++ b/frame.js @@ -483,8 +483,15 @@ Volcanos(chat.ONLAYOUT, {_init: function(can, target) { target = target||can._ro // event.target.getBoundingClientRect() var layout = right? {left: rect.right, top: rect.top}: {left: rect.left, top: rect.bottom} can.getActionSize(function(left, top, width, height) { left = left||0, top = top||0, height = can.base.Max(height, can.page.height()-top) - can.page.style(can, target, html.MAX_HEIGHT, can.base.Max(max > 0.5 || layout.top > (top+height)*0.5? height: top+height-layout.top, height*(max||0.5))) - if (layout.top+target.offsetHeight > top+height) { layout.top = top+height-target.offsetHeight } + // can.page.style(can, target, html.MAX_HEIGHT, max? height*max: top+height-layout.top) + if (max && layout.top-top > height*max) { + can.page.style(can, target, html.MAX_HEIGHT, layout.top-top-(rect.bottom-rect.top)) + layout.top = layout.top-target.offsetHeight-(rect.bottom-rect.top) + } else { + can.page.style(can, target, html.MAX_HEIGHT, max? height*max: top+height-layout.top) + // can.page.style(can, target, html.MAX_HEIGHT, top+height-layout.top) + if (layout.top+target.offsetHeight > top+height) { layout.top = top+height-target.offsetHeight } + } if (layout.left+target.offsetWidth > left+width) { layout.left = left+width-target.offsetWidth } }); return can.onmotion.move(can, target, layout), layout }, diff --git a/lib/user.js b/lib/user.js index 4a55b84d..91af710c 100644 --- a/lib/user.js +++ b/lib/user.js @@ -121,7 +121,7 @@ Volcanos("user", { return item === ""? /* 0.space */ {type: html.HR}: can.base.isString(item)||can.base.isNumber(item)? /* 1.string */ {view: [html.ITEM, html.DIV, can.user.trans(can, item, trans)], onclick: function(event) { click(event, item) }, onmouseenter: function(event) { remove_sub(carte) } }: can.base.isArray(item)? /* 2.array */ {view: html.ITEM, list: [{text: can.user.trans(can, item[0], trans)}, {text: [ice.SP+can.page.unicode.gt, "", [html.ICON, "gt"]]}], onmouseenter: subs, onclick: subs}: /* 3.object */ item })}]); can.onkeymap.prevent(event), can.page.Select(can, ui._target, html.IMG, function(target) { target.onload = function() { can.onlayout.figure(event, can, ui._target) } }) - var carte = {_target: ui._target, _parent: parent, layout: can.onlayout.figure(event, can, ui._target, false, 0.8), close: function() { can.page.Remove(can, ui._target) }}; return carte + var carte = {_target: ui._target, _parent: parent, layout: can.onlayout.figure(event, can, ui._target, false, 0.6), close: function() { can.page.Remove(can, ui._target) }}; return carte }, carteRight: function(event, can, meta, list, cb, parent) { var carte = can.user.carte(event, can, meta, list, cb, parent) return can.onlayout.figure(event, can, carte._target, true), carte @@ -159,7 +159,7 @@ Volcanos("user", { }); if (err) { return } can.onkeymap.prevent(event) can.core.CallFunc(cb, {event: can.request(event, {_handle: ice.TRUE})._event, button: button, data: data, list: list, args: args, input: action}) || action.cancel() }, _target: ui._target, _engine: function(event, can, button) { action.submit(event, can, button) }, - }); can.onlayout.figure(event, can, ui._target, false, 1), can.onmotion.delay(can, function() { action.focus() }) + }); can.onlayout.figure(event, can, ui._target, false, 0.8), can.onmotion.delay(can, function() { action.focus() }) return button === true && action.submit(event, can, html.SUBMIT), action }, select: function(event, can, type, fields, cb, cbs) {