diff --git a/frame.js b/frame.js index bb1feaf7..43bf1585 100644 --- a/frame.js +++ b/frame.js @@ -488,11 +488,19 @@ Volcanos("onlayout", {help: "页面布局", list: [], _init: function(can, targe topic: function(can, topic) { topic && (can._topic = topic) can.user.topic(can, can._topic || can.user.Search(can, "topic") || ((can.user.Search(can, "pod")||can.base.isNight())? "black": "white")) }, - figure: function(can, ui, event) { + figure: function(can, ui, event) { var p = ui.fieldset var layout = {top: event.clientY+10, left: event.clientX} - can.page.Modify(can, ui.fieldset, {style: layout}) - can.onmotion.move(can, ui.fieldset, layout) + can.page.Modify(can, p, {style: layout}) + + can.onmotion.move(can, p, layout) can.page.Remove(can, ui.legend) + + var left = p.offsetLeft + if (p.offsetLeft+p.offsetWidth > window.innerWidth) { + left = window.innerWidth - p.offsetWidth + } + if (left < 120) { left = 120 } + can.page.Modify(can, p, {style: {left: left}}) }, background: function(can, url, target) { target = target || document.body can.page.Modify(can, target, {style: {background: url == "" || url == "void"? "": 'url("'+url+'")'}}) diff --git a/page/index.css b/page/index.css index 19853cc4..a71a4123 100644 --- a/page/index.css +++ b/page/index.css @@ -239,12 +239,13 @@ fieldset>div.output div.project div.list { body>fieldset.input { position:fixed; top:32px; -} -body>fieldset.input { - background-color:#30a7a93d; + background-color:#0d4142a6; position:fixed; z-index:50; } +body>fieldset.input div.output { + max-height:400px; +} body>fieldset.input.key { z-index:60; } diff --git a/plugin/input/key.js b/plugin/input/key.js index 8f5d36d6..35e7c695 100644 --- a/plugin/input/key.js +++ b/plugin/input/key.js @@ -14,6 +14,8 @@ Volcanos("onfigure", {help: "控件详情", list: [], key: {onclick: function(ev can.page.Remove(can, figure.fieldset) }} }, figure.output) + + can.onlayout.figure(can, figure, event) }, true) }; run() }}, }, []) diff --git a/plugin/input/province.js b/plugin/input/province.js index 6c5adf18..dc006a79 100644 --- a/plugin/input/province.js +++ b/plugin/input/province.js @@ -5,11 +5,12 @@ Volcanos("onfigure", {help: "控件详情", list: [], province: {onclick: functi "清空": function(event) { target.value = "" }, }) - can.page.Modify(can, figure.fieldset, {style: {left: 120}}) var china_chart = echarts.init(can.page.Append(can, figure.output, [{type: "div", style: {width: "600px", height: "400px"}}]).first); china_chart.setOption({geo: {map: 'china'}}), china_chart.on('click', function (params) { target.value = params.name, can.page.Remove(can, figure.fieldset) }) + + can.onlayout.figure(can, figure, event) }) }}, })