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