mirror of
https://shylinux.com/x/volcanos
synced 2025-04-26 01:04:06 +08:00
opt inner.layout
This commit is contained in:
parent
575e91caf4
commit
d416333c3b
14
frame.js
14
frame.js
@ -782,14 +782,20 @@ Volcanos("onmotion", {help: "动态交互", list: [], _init: function(can) {
|
||||
|
||||
move: function(can, target, layout) { var begin
|
||||
target.onmousedown = function(event) {
|
||||
begin = {left: layout.left, top: layout.top, x: event.x, y: event.y}
|
||||
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.onmousemove = function(event) {
|
||||
if (!begin || !event.ctrlKey) { return }
|
||||
layout.top = begin.top + event.y - begin.y
|
||||
layout.left = begin.left + event.x - begin.x
|
||||
can.page.Modify(can, target, {style: {left: layout.left, top: layout.top}})
|
||||
if (event.shiftKey) {
|
||||
layout.width = layout.width + event.x - begin.x
|
||||
layout.height = layout.height + event.y - begin.y
|
||||
can.page.Modify(can, target, {style: {width: layout.width, height: layout.height}})
|
||||
} else {
|
||||
layout.top = begin.top + event.y - begin.y
|
||||
layout.left = begin.left + event.x - begin.x
|
||||
can.page.Modify(can, target, {style: {left: layout.left, top: layout.top}})
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
@ -18,8 +18,11 @@ fieldset.editor>form.option div.item input.args[name=line] {
|
||||
width:40px;
|
||||
}
|
||||
|
||||
fieldset.editor {
|
||||
background:#0b2c54ab;
|
||||
}
|
||||
fieldset.editor>div.output {
|
||||
background-color:#173d40cc;
|
||||
background-color:#173d40ab;
|
||||
}
|
||||
fieldset.editor>div.output div.project {
|
||||
max-height:400px; overflow:auto;
|
||||
@ -35,7 +38,8 @@ fieldset.editor>div.output div.project div.item:hover {
|
||||
}
|
||||
|
||||
fieldset.editor>div.output div.profile {
|
||||
max-height:400px; overflow:auto;
|
||||
min-height:400px;
|
||||
max-height:600px; overflow:auto;
|
||||
}
|
||||
fieldset.editor>div.output div.preview {
|
||||
font-family:monospace;
|
||||
@ -104,9 +108,11 @@ fieldset.editor>div.output pre.display:hover {
|
||||
}
|
||||
|
||||
fieldset.editor>div.output div.search {
|
||||
/* position:relative; top:-200px; */
|
||||
height:220px; overflow:auto;
|
||||
background-color:#060627ab;
|
||||
text-align:left;
|
||||
padding:6px; border:solid 1px red;
|
||||
height:120px; overflow:auto;
|
||||
clear:both;
|
||||
color:white;
|
||||
}
|
||||
|
@ -48,12 +48,10 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, list, cb,
|
||||
can.file = file, can.parse = can.base.Ext(file||path), can.max = 0
|
||||
can.onsyntax._init(can, can._msg)
|
||||
|
||||
can.onaction._resize(can, true)
|
||||
|
||||
// can.onaction._resize(can, can.ui.project.style.display != "none")
|
||||
can.Status("文件名", can.file), can.Status("解析器", can.parse)
|
||||
can.Status("当前行", can.onexport.position(can, 0))
|
||||
can.Status("模式", "normal")
|
||||
|
||||
}
|
||||
if (can.tabview[path+file]) { return show() }
|
||||
|
||||
@ -168,9 +166,11 @@ Volcanos("onaction", {help: "控件交互", list: [],
|
||||
},
|
||||
"项目": function(event, can) {
|
||||
var hide = can.ui.project.style.display == "none"
|
||||
can.onimport.project(can, can.Option("path"), function() {
|
||||
can.onaction._resize(can, hide)
|
||||
})
|
||||
hide? can.onimport.project(can, can.Option("path"), function() {
|
||||
can.page.Modify(can, can.ui.project, {style: {display: ""}}), can.onaction._resize(can, true)
|
||||
}): (
|
||||
can.page.Modify(can, can.ui.project, {style: {display: "none"}}), can.onaction._resize(can, false)
|
||||
)
|
||||
can.onaction.selectLine(can, can.current)
|
||||
},
|
||||
"搜索": function(event, can) { var hide = can.ui.search.style.display == "none"
|
||||
@ -186,9 +186,8 @@ Volcanos("onaction", {help: "控件交互", list: [],
|
||||
}, true)
|
||||
},
|
||||
_resize: function(can, hide) {
|
||||
can.page.Modify(can, can.ui.project, {style: {display: hide? "": "none"}})
|
||||
can.Timer(10, function() {
|
||||
var width = can._target.offsetWidth - (hide? can.ui.project.offsetWidth: 0) - 30
|
||||
var width = ((parseInt(can.Conf("width"))-120)||can._target.offsetWidth) - (hide? can.ui.project.offsetWidth+10: 0)
|
||||
can.page.Modify(can, can.ui.profile, {style: {width: width}})
|
||||
width -= can.ui.preview.offsetWidth + 20
|
||||
can.page.Modify(can, can.ui.content, {style: {"max-width": width}})
|
||||
@ -198,6 +197,13 @@ Volcanos("onaction", {help: "控件交互", list: [],
|
||||
appendLine: function(can, value) { var index = ++can.max
|
||||
can.page.Append(can, can.ui.preview, [{view: ["item", "div", index], onclick: function(event) {
|
||||
can.onaction.selectLine(can, index)
|
||||
}, ondblclick: function(event) {
|
||||
can.user.input(event, can, [{_input: "text", name: "topic", value: "@key"}, "name"], function(event, button, meta, list) {
|
||||
can.run(event, ["favor", "topic", meta.topic, "type", can.parse, "name", meta.name, "text", value, "file", can.file, "line", index], function(msg) {
|
||||
can.user.toast(can, "收藏成功")
|
||||
}, true)
|
||||
return true
|
||||
})
|
||||
}}])
|
||||
var line = can.page.Append(can, can.ui.content, [{view: ["item", "pre", ""], onclick: function(event) {
|
||||
can.onkeymap && can.onkeymap._init(can, "insert")
|
||||
@ -239,6 +245,8 @@ Volcanos("onaction", {help: "控件交互", list: [],
|
||||
can.Option("line", index+1)
|
||||
|
||||
target = item, can.Status("当前行", can.onexport.position(can, index))
|
||||
can.Status("文件名", can.file), can.Status("解析器", can.parse)
|
||||
can.Status("模式", "normal")
|
||||
can.page.Select(can, can.ui.preview, "div.item", function(item, i) {
|
||||
can.page.ClassList[index==i? "add": "del"](can, item, "select")
|
||||
})
|
||||
@ -282,7 +290,7 @@ Volcanos("onaction", {help: "控件交互", list: [],
|
||||
})
|
||||
Volcanos("onexport", {help: "导出数据", list: ["模式", "按键", "文件名", "解析器", "当前行", "标签数"],
|
||||
position: function(can, index, total) { total = total || can.max
|
||||
return parseInt((index+1)*100/total)+"%"+" = "+(parseInt(index)+1)+"/"+parseInt(total)
|
||||
return (parseInt(index)+1)+"/"+parseInt(total)+" = "+parseInt((index+1)*100/total)+"%"
|
||||
},
|
||||
content: function(can) {
|
||||
return can.page.Select(can, can._output, "div.content>pre.item", function(item) {
|
||||
|
@ -109,10 +109,9 @@ Volcanos("onaction", {help: "组件菜单", list: ["编辑", ["view", "横向",
|
||||
}
|
||||
|
||||
can.onaction._show(can, [can.Option("path"), tree.file, tree.line], {
|
||||
position: "fixed",
|
||||
position: "fixed", width: 800, height: 600,
|
||||
left: event.x-(event.x>600? 400: 100),
|
||||
top: event.y-(event.y>600? 400: 0),
|
||||
width: 600, height: 600,
|
||||
})
|
||||
}
|
||||
tree.view.onmouseenter = function(event) {
|
||||
@ -148,21 +147,29 @@ Volcanos("onaction", {help: "组件菜单", list: ["编辑", ["view", "横向",
|
||||
})
|
||||
},
|
||||
_resize: function(can, layout) {
|
||||
can.Conf("width", layout.width)
|
||||
can.Conf("height", layout.height)
|
||||
can.page.Modify(can, can._target, {style: layout})
|
||||
can.page.Select(can, can._output, "div.profile", function(item) {
|
||||
can.page.Modify(can, item, {style: {
|
||||
"max-height": layout.height,
|
||||
"max-height": layout.height-60,
|
||||
"width": layout.width,
|
||||
}})
|
||||
})
|
||||
can.page.Select(can, can._output, "div.content", function(item) {
|
||||
can.page.Modify(can, item, {style: {
|
||||
"max-width": layout.width - 120,
|
||||
"max-width": layout.width - 100,
|
||||
}})
|
||||
})
|
||||
can.page.Select(can, can._output, "div.search", function(item) {
|
||||
can.page.Modify(can, item, {style: {
|
||||
position: "absolute", bottom: 0,
|
||||
width: layout.width,
|
||||
}})
|
||||
})
|
||||
},
|
||||
_show: function(can, args, layout) {
|
||||
can.onappend.plugin(can, {index: "web.code.inner", args: args, _action: ["最大", "上下", "左右", "复制", "关闭"], width: layout.width, height: layout.height}, function(sub, value) {
|
||||
can.onappend.plugin(can, {index: "web.code.inner", args: args, _action: ["最大", "分屏", "复制", "关闭"], width: layout.width, height: layout.height}, function(sub, value) {
|
||||
can.onmotion.move(sub, sub._target, layout)
|
||||
can.onaction._resize(sub, layout)
|
||||
|
||||
@ -178,28 +185,38 @@ Volcanos("onaction", {help: "组件菜单", list: ["编辑", ["view", "横向",
|
||||
width: layout.width, height: layout.height,
|
||||
})
|
||||
break
|
||||
case "上下":
|
||||
layout.height = layout.height/2-20
|
||||
can.onaction._resize(sub, layout)
|
||||
case "分屏":
|
||||
if (event.ctrlKey) {
|
||||
layout.height = layout.height/2
|
||||
can.onaction._resize(sub, layout)
|
||||
|
||||
can.onaction._show(can, args, {
|
||||
position: "fixed",
|
||||
left: layout.left, top: layout.top+layout.height+10,
|
||||
width: layout.width, height: layout.height,
|
||||
})
|
||||
break
|
||||
}
|
||||
|
||||
can.onaction._show(can, args, {
|
||||
position: "fixed",
|
||||
left: layout.left, top: layout.top+layout.height+70,
|
||||
width: layout.width, height: layout.height,
|
||||
})
|
||||
break
|
||||
case "左右":
|
||||
layout.width = layout.width/2
|
||||
can.onaction._resize(sub, layout)
|
||||
|
||||
can.onaction._show(can, args, {
|
||||
position: "fixed",
|
||||
left: layout.left+layout.width, top: layout.top,
|
||||
left: layout.left+layout.width+10, top: layout.top,
|
||||
width: layout.width, height: layout.height,
|
||||
})
|
||||
break
|
||||
case "最大":
|
||||
layout.left = 0, layout.top = 0
|
||||
if (event.ctrlKey) {
|
||||
layout.left = 0, layout.top = 40
|
||||
layout.width = window.innerWidth/2
|
||||
layout.height = window.innerHeight/2
|
||||
can.onaction._resize(sub, layout)
|
||||
break
|
||||
}
|
||||
|
||||
layout.left = 0, layout.top = 40
|
||||
layout.width = window.innerWidth-40
|
||||
layout.height = window.innerHeight-60
|
||||
can.onaction._resize(sub, layout)
|
||||
|
@ -63,7 +63,12 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
||||
var target = event.target; if (target.tagName == "INPUT" && target.type == "button") {
|
||||
var msg = can.sup.request(event); msg.Option(can.Option()), msg.Option(line)
|
||||
var cb = can.onaction[target.value]; return typeof cb == "function"? cb(event, can, target.value):
|
||||
can.sup.onaction.input(event, can.sup, target.value, function(msg) { can.run({}) })
|
||||
can.sup.onaction.input(event, can.sup, target.value, function(msg) {
|
||||
if (can.onimport._process(can, msg)) {
|
||||
return typeof cb == "function" && cb(msg)
|
||||
}
|
||||
can.run({})
|
||||
})
|
||||
}
|
||||
can.sup.onaction.change(event, can.sup, key, value, function(msg) {
|
||||
can.run(event)
|
||||
@ -95,7 +100,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
||||
value.feature = can.base.Obj(msg.meta&&msg.meta[0]||"{}", {})
|
||||
value.name && can.onappend._init(can, value, Volcanos.meta.libs.concat(["/plugin/state.js"]), function(sub) {
|
||||
sub.run = function(event, cmds, cb, silent) {
|
||||
can.run(event, msg["_prefix"].concat(cmds), cb, true)
|
||||
can.run(event, (msg["_prefix"]||[]).concat(cmds), cb, true)
|
||||
}
|
||||
}, can._output)
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user