mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
opt inner
This commit is contained in:
parent
2fce469514
commit
b896e34ac7
17
frame.js
17
frame.js
@ -538,6 +538,7 @@ Volcanos("onappend", {help: "渲染引擎", list: [], _init: function(can, meta,
|
||||
|
||||
var plugin = can.onappend._init(can, value, Volcanos.meta.libs.concat(["/plugin/state.js"]), function(sub) {
|
||||
typeof cb == "function" && cb(sub, value)
|
||||
sub.page.Remove(sub, sub._legend)
|
||||
}, target || document.body)
|
||||
}, true)
|
||||
},
|
||||
@ -778,5 +779,21 @@ Volcanos("onmotion", {help: "动态交互", list: [], _init: function(can) {
|
||||
}, function() {
|
||||
})
|
||||
},
|
||||
|
||||
move: function(can, target, layout) { var begin
|
||||
target.onmousedown = function(event) {
|
||||
begin = {left: layout.left, top: layout.top, x: event.x, y: event.y}
|
||||
}
|
||||
target.onmousemove = function(event) {
|
||||
if (event.target == target && begin) {
|
||||
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}})
|
||||
}
|
||||
}
|
||||
target.onmouseup = function(event) {
|
||||
begin = null
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -4,7 +4,7 @@ body.white fieldset.plugin.editor {
|
||||
fieldset.editor>div.action>div.file {
|
||||
border:solid 2px red; padding:2px;
|
||||
float:left; margin:2px 0;
|
||||
background-color:#211515;
|
||||
/* background-color:#211515; */
|
||||
cursor:pointer;
|
||||
}
|
||||
fieldset.editor>div.action>div.file.over {
|
||||
@ -12,6 +12,7 @@ fieldset.editor>div.action>div.file.over {
|
||||
}
|
||||
fieldset.editor>div.action>div.file.select {
|
||||
background-color:green;
|
||||
color:white;
|
||||
}
|
||||
fieldset.editor>form.option div.item input.args[name=line] {
|
||||
width:40px;
|
||||
@ -57,7 +58,7 @@ fieldset.editor>div.output div.content {
|
||||
font-size:16px; font-family:monospace;
|
||||
border-left:solid 2px red;
|
||||
min-height:20px;
|
||||
min-width:800px;
|
||||
/* min-width:800px; */
|
||||
max-width:1000px;
|
||||
overflow:auto;
|
||||
float:left;
|
||||
|
@ -48,10 +48,12 @@ 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)
|
||||
|
||||
var width = can._target.offsetWidth - can.ui.project.offsetWidth - can.ui.preview.offsetWidth - 30
|
||||
can.Status("当前行", can.onexport.position(can, parseInt(can.Option("line")))-1)
|
||||
can.page.Modify(can, can.ui.content, {style: {"max-width": width+"px"}})
|
||||
can.page.Modify(can, can.ui.profile, {style: {width: width+60+"px"}})
|
||||
can.onaction._resize(can, true)
|
||||
|
||||
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() }
|
||||
|
||||
@ -64,12 +66,12 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, list, cb,
|
||||
}}]).first).click()
|
||||
}, true)
|
||||
},
|
||||
project: function(can, path) { can.Option({path: path})
|
||||
project: function(can, path, cb) { can.Option({path: path})
|
||||
var msg = can.request({}); msg.Option("dir_deep", "true")
|
||||
can.run(msg._event, ["action", "render", "dir", "", path+"/"], function(msg) { can.ui.project.innerHTML = ""
|
||||
can.onappend.tree(can, msg, can.ui.project, function(event, value) {
|
||||
can.onimport.tabview(can, can.Option("path"), value.path)
|
||||
})
|
||||
}), typeof cb == "function" && cb()
|
||||
}, true)
|
||||
},
|
||||
}, ["/plugin/local/code/inner.css"])
|
||||
@ -164,11 +166,11 @@ Volcanos("onaction", {help: "控件交互", list: [],
|
||||
var last = can.history.pop(); last = can.history.pop()
|
||||
last && can.onimport.tabview(can, last.path, last.file, last.line)
|
||||
},
|
||||
"项目": function(event, can) { var hide = can.ui.project.style.display == "none"
|
||||
can.page.Modify(can, can.ui.project, {style: {display: hide? "": "none"}})
|
||||
var width = can._target.offsetWidth - can.ui.project.offsetWidth - can.ui.preview.offsetWidth - 120
|
||||
// can.page.Modify(can, can.ui.content, {style: {"max-width": hide? width+"px": ""}})
|
||||
hide && can.onimport.project(can, can.Option("path"))
|
||||
"项目": function(event, can) {
|
||||
var hide = can.ui.project.style.display == "none"
|
||||
can.onimport.project(can, can.Option("path"), function() {
|
||||
can.onaction._resize(can, hide)
|
||||
})
|
||||
can.onaction.selectLine(can, can.current)
|
||||
},
|
||||
"搜索": function(event, can) { var hide = can.ui.search.style.display == "none"
|
||||
@ -183,6 +185,15 @@ Volcanos("onaction", {help: "控件交互", list: [],
|
||||
can.onappend.board(can, can.ui.display, "board", msg)
|
||||
}, 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
|
||||
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}})
|
||||
})
|
||||
},
|
||||
|
||||
appendLine: function(can, value) { var index = ++can.max
|
||||
can.page.Append(can, can.ui.preview, [{view: ["item", "div", index], onclick: function(event) {
|
||||
|
@ -162,28 +162,15 @@ Volcanos("onaction", {help: "组件菜单", list: ["编辑", ["view", "横向",
|
||||
})
|
||||
},
|
||||
_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)
|
||||
|
||||
var begin
|
||||
sub._target.onmousedown = function(event) {
|
||||
begin = {left: layout.left, top: layout.top, x: event.x, y: event.y}
|
||||
console.log(begin)
|
||||
}
|
||||
sub._target.onmousemove = function(event) {
|
||||
if (event.target == sub._target && begin) {
|
||||
layout.left= begin.left + event.x - begin.x
|
||||
layout.top= begin.top + event.y - begin.y
|
||||
sub.page.Modify(sub, sub._target, {style: {left: layout.left, top: layout.top}})
|
||||
console.log(layout)
|
||||
}
|
||||
}
|
||||
sub._target.onmouseup = function(event) {
|
||||
begin = null
|
||||
}
|
||||
|
||||
sub.run = function(event, cmds, cb, silent) {
|
||||
switch (cmds[1]) {
|
||||
case "关闭":
|
||||
can.page.Remove(can, sub._target)
|
||||
break
|
||||
case "复制":
|
||||
can.onaction._show(can, args, {
|
||||
position: "fixed",
|
||||
@ -191,9 +178,6 @@ Volcanos("onaction", {help: "组件菜单", list: ["编辑", ["view", "横向",
|
||||
width: layout.width, height: layout.height,
|
||||
})
|
||||
break
|
||||
case "重围":
|
||||
can.onaction._resize(sub, layout)
|
||||
break
|
||||
case "上下":
|
||||
layout.height = layout.height/2-20
|
||||
can.onaction._resize(sub, layout)
|
||||
@ -210,8 +194,8 @@ Volcanos("onaction", {help: "组件菜单", list: ["编辑", ["view", "横向",
|
||||
|
||||
can.onaction._show(can, args, {
|
||||
position: "fixed",
|
||||
left: layout.left+layout.width+10, top: layout.top,
|
||||
width: layout.width-10, height: layout.height,
|
||||
left: layout.left+layout.width, top: layout.top,
|
||||
width: layout.width, height: layout.height,
|
||||
})
|
||||
break
|
||||
case "最大":
|
||||
@ -220,12 +204,11 @@ Volcanos("onaction", {help: "组件菜单", list: ["编辑", ["view", "横向",
|
||||
layout.height = window.innerHeight-60
|
||||
can.onaction._resize(sub, layout)
|
||||
break
|
||||
case "关闭":
|
||||
can.page.Remove(can, sub._target)
|
||||
break
|
||||
default:
|
||||
can.run(event, ["inner"].concat(cmds), function(msg) {
|
||||
cb(msg), can.onaction._resize(sub, layout)
|
||||
cb(msg), can.Timer(10, function() {
|
||||
can.onaction._resize(sub, layout)
|
||||
})
|
||||
}, true)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user