mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
opt code
This commit is contained in:
parent
c5b2d48b7b
commit
37040d7697
2
frame.js
2
frame.js
@ -318,7 +318,7 @@ Volcanos("onappend", { _init: function(can, meta, list, cb, target, field) { met
|
|||||||
_legend: function(can, legend) {
|
_legend: function(can, legend) {
|
||||||
legend && (legend.onclick = function(event) { var msg = can.request(event)
|
legend && (legend.onclick = function(event) { var msg = can.request(event)
|
||||||
can.core.List(["share", "pod"], function(key) { var value = can.user.Search(can, key)
|
can.core.List(["share", "pod"], function(key) { var value = can.user.Search(can, key)
|
||||||
value != undefined && msg.Option(key, can.user.Search(key))
|
value != undefined && msg.Option(key, can.user.Search(can, key))
|
||||||
})
|
})
|
||||||
can.core.List(["River", "Storm", "Action"], function(item) {
|
can.core.List(["River", "Storm", "Action"], function(item) {
|
||||||
can.run(event, ["search", item+".onexport.key"])
|
can.run(event, ["search", item+".onexport.key"])
|
||||||
|
@ -136,11 +136,12 @@ fieldset>div.output>div.profile>div.item:hover {
|
|||||||
}
|
}
|
||||||
fieldset>div.output>pre.display {
|
fieldset>div.output>pre.display {
|
||||||
position:sticky; bottom:0;
|
position:sticky; bottom:0;
|
||||||
max-height:120px;
|
/* max-height:120px; */
|
||||||
|
max-height:400px;
|
||||||
clear:both;
|
clear:both;
|
||||||
}
|
}
|
||||||
fieldset>div.output>pre.display:hover {
|
fieldset>div.output>pre.display:hover {
|
||||||
max-height:640px;
|
/* max-height:640px; */
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldset div.code {
|
fieldset div.code {
|
||||||
|
@ -31,7 +31,6 @@ Volcanos("onimport", {help: "导入数据", _init: function(can, msg, list, cb,
|
|||||||
can.onimport.project(can, can.Option("path"))
|
can.onimport.project(can, can.Option("path"))
|
||||||
can.onsyntax._init(can, msg)
|
can.onsyntax._init(can, msg)
|
||||||
can.onkeymap._init(can)
|
can.onkeymap._init(can)
|
||||||
can.onlayout._init(can)
|
|
||||||
})
|
})
|
||||||
return typeof cb == "function" && cb(msg)
|
return typeof cb == "function" && cb(msg)
|
||||||
},
|
},
|
||||||
@ -629,7 +628,9 @@ Volcanos("onaction", {help: "控件交互", list: [
|
|||||||
can.user.toast(can, "执行成功")
|
can.user.toast(can, "执行成功")
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
"项目": function(event, can) { can.onlayout.project(can) },
|
"项目": function(event, can) { var hide = can.ui.project.style.display == "none"
|
||||||
|
can.page.Modify(can, can.ui.project, {style: {display: hide? "": "none"}})
|
||||||
|
},
|
||||||
"上传": function(event, can) { can.user.upload(event, can) },
|
"上传": function(event, can) { can.user.upload(event, can) },
|
||||||
"搜索": function(event, can) { can.onkeymap._remote(event, can, "搜索", ["action", "find", "vim.history", "", "id", "type", "name", "text"]) },
|
"搜索": function(event, can) { can.onkeymap._remote(event, can, "搜索", ["action", "find", "vim.history", "", "id", "type", "name", "text"]) },
|
||||||
"记录": function(event, can) { var sub = can.request(event)
|
"记录": function(event, can) { var sub = can.request(event)
|
||||||
@ -667,14 +668,6 @@ Volcanos("ondetail", {help: "菜单交互", list: ["保存", "运行", "提交",
|
|||||||
can.onaction.appendLine(can)
|
can.onaction.appendLine(can)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos("onlayout", {help: "页面布局", list: [], _init: function(can) {
|
|
||||||
can.onlayout.project(can)
|
|
||||||
can.onlayout.project(can)
|
|
||||||
},
|
|
||||||
project: function(can) { var hide = can.ui.project.style.display == "none"
|
|
||||||
can.page.Modify(can, can.ui.project, {style: {display: hide? "": "none"}})
|
|
||||||
},
|
|
||||||
})
|
|
||||||
Volcanos("onexport", {help: "导出数据", list: ["输入法", "输入值", "文件名", "解析器", "当前行", "ncmd"],
|
Volcanos("onexport", {help: "导出数据", list: ["输入法", "输入值", "文件名", "解析器", "当前行", "ncmd"],
|
||||||
content: function(can) {
|
content: function(can) {
|
||||||
return can.page.Select(can, can._output, "div.content>pre.item", function(item) {
|
return can.page.Select(can, can._output, "div.content>pre.item", function(item) {
|
||||||
|
@ -23,6 +23,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 加载事件
|
||||||
can.core.Item(can.onaction, function(key, value) {
|
can.core.Item(can.onaction, function(key, value) {
|
||||||
if (key.indexOf("on") == -1 || !can.onaction.hasOwnProperty(key)) { return }
|
if (key.indexOf("on") == -1 || !can.onaction.hasOwnProperty(key)) { return }
|
||||||
can.svg[key] = can.ui.content[key] || function(event) {
|
can.svg[key] = can.ui.content[key] || function(event) {
|
||||||
@ -49,9 +50,8 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
group: function(can, target) { var name = target.Groups() || "svg"
|
group: function(can, target) { var name = target.Groups() || "svg"
|
||||||
return can.onappend.item(can, can.ui.project, "item", {name: name}, function(event) {
|
return can.onappend.item(can, can.ui.project, "item", {name: name}, function(event) {
|
||||||
can.group = target, can.core.List(["font-size", "storke-width", "stroke", "fill"], function(key) {
|
can.group = target, can.core.List(["font-size", "storke-width", "stroke", "fill"], function(key) {
|
||||||
can.onmotion.show(can, target, {value: 100, length: 10})
|
|
||||||
can.Action(key, target.Value(key)||can.Action(key))
|
can.Action(key, target.Value(key)||can.Action(key))
|
||||||
})
|
}), can.onmotion.show(can, target, {value: 100, length: 10})
|
||||||
}, function(event) {
|
}, function(event) {
|
||||||
can.user.carte(can, can.onaction||{}, ["隐藏", "显示", "添加", "删除", "清空"], function(ev, item, meta) {
|
can.user.carte(can, can.onaction||{}, ["隐藏", "显示", "添加", "删除", "清空"], function(ev, item, meta) {
|
||||||
switch (item) {
|
switch (item) {
|
||||||
@ -70,11 +70,6 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
block: function(can, target) {
|
block: function(can, target) {
|
||||||
target.ondblclick = function(event) {
|
|
||||||
can.ondetail["标签"](event, can)
|
|
||||||
event.stopPropagation()
|
|
||||||
event.preventDefault()
|
|
||||||
}
|
|
||||||
target.Val = function(key, value) {
|
target.Val = function(key, value) {
|
||||||
return parseInt(target.Value(key, value == undefined? value: parseInt(value)||0)) || 0
|
return parseInt(target.Value(key, value == undefined? value: parseInt(value)||0)) || 0
|
||||||
}
|
}
|
||||||
@ -111,6 +106,11 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
}
|
}
|
||||||
return list.reverse().join(".")
|
return list.reverse().join(".")
|
||||||
}
|
}
|
||||||
|
target.ondblclick = function(event) {
|
||||||
|
can.ondetail["标签"](event, can)
|
||||||
|
event.stopPropagation()
|
||||||
|
event.preventDefault()
|
||||||
|
}
|
||||||
return target
|
return target
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -207,13 +207,16 @@ Volcanos("onfigure", {help: "图形绘制", list: [],
|
|||||||
}
|
}
|
||||||
return can.last = rect
|
return can.last = rect
|
||||||
},
|
},
|
||||||
_copy: function(can, target) {
|
_ship: function(can, target, value) {
|
||||||
|
return target.Value("ship", target.Value("ship").concat([value]))
|
||||||
|
},
|
||||||
|
_copy: function(event, can, target) {
|
||||||
var figure = can.onfigure._get(can, target).data
|
var figure = can.onfigure._get(can, target).data
|
||||||
|
|
||||||
var data = {}
|
var data = {}
|
||||||
can.core.List(figure.copy, function(item) { data[item] = target.Value(item) })
|
can.core.List(figure.copy, function(item) { data[item] = target.Value(item) })
|
||||||
data[figure.size.x||"x"] = target.Val(figure.size.x||"x")
|
data[figure.size.x||"x"] = target.Val(figure.size.x||"x")+10
|
||||||
data[figure.size.y||"y"] = target.Val(figure.size.y||"y")
|
data[figure.size.y||"y"] = target.Val(figure.size.y||"y")+10
|
||||||
|
|
||||||
var p = data && can.onfigure._push(can, data, target.tagName, can.group||can.svg)
|
var p = data && can.onfigure._push(can, data, target.tagName, can.group||can.svg)
|
||||||
can.page.Select(can, can.svg, "."+target.Value("text"), function(item) {
|
can.page.Select(can, can.svg, "."+target.Value("text"), function(item) {
|
||||||
@ -221,9 +224,6 @@ Volcanos("onfigure", {help: "图形绘制", list: [],
|
|||||||
})
|
})
|
||||||
return p
|
return p
|
||||||
},
|
},
|
||||||
_ship: function(can, target, value) {
|
|
||||||
return target.Value("ship", target.Value("ship").concat([value]))
|
|
||||||
},
|
|
||||||
|
|
||||||
svg: {
|
svg: {
|
||||||
data: {
|
data: {
|
||||||
@ -259,8 +259,7 @@ Volcanos("onfigure", {help: "图形绘制", list: [],
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
text: {
|
text: {
|
||||||
data: { size: {x: "x", y: "y"},
|
data: { size: {x: "x", y: "y"}, copy: ["inner"],
|
||||||
copy: ["inner"],
|
|
||||||
}, // <text x="60" y="10">hi<text>
|
}, // <text x="60" y="10">hi<text>
|
||||||
draw: function(event, can, point, style) { if (point.length < 1 || event.type == "mousemove") { return }
|
draw: function(event, can, point, style) { if (point.length < 1 || event.type == "mousemove") { return }
|
||||||
var p0 = point[0]; var data = {
|
var p0 = point[0]; var data = {
|
||||||
@ -274,8 +273,7 @@ Volcanos("onfigure", {help: "图形绘制", list: [],
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
line: {
|
line: {
|
||||||
data: { size: {},
|
data: { size: {}, copy: ["x1", "y1", "x2", "y2"],
|
||||||
copy: ["x1", "y1", "x2", "y2"],
|
|
||||||
x: function(event, can, value, cmd, target) {
|
x: function(event, can, value, cmd, target) {
|
||||||
if (value != undefined) {
|
if (value != undefined) {
|
||||||
var offset = value - target.Val("xx")
|
var offset = value - target.Val("xx")
|
||||||
@ -326,7 +324,7 @@ Volcanos("onfigure", {help: "图形绘制", list: [],
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
path: {
|
path: {
|
||||||
data: { size: {},
|
data: { size: {}, copy: ["d", "name", "meta", "tt", "xx", "yy"],
|
||||||
x: function(event, can, value, cmd, target) {
|
x: function(event, can, value, cmd, target) {
|
||||||
var tt = JSON.parse(target.Value("tt")||'{"tx":0, "ty":0}')
|
var tt = JSON.parse(target.Value("tt")||'{"tx":0, "ty":0}')
|
||||||
if (value != undefined) {
|
if (value != undefined) {
|
||||||
@ -345,7 +343,6 @@ Volcanos("onfigure", {help: "图形绘制", list: [],
|
|||||||
}
|
}
|
||||||
return target.Val("yy")+tt.ty
|
return target.Val("yy")+tt.ty
|
||||||
},
|
},
|
||||||
copy: ["d", "cmd", "name", "meta", "tt", "xx", "yy", "fill"],
|
|
||||||
}, // <path d="M10 10 H 90 V 90 H 10 Z" fill="transparent" stroke="black"/>
|
}, // <path d="M10 10 H 90 V 90 H 10 Z" fill="transparent" stroke="black"/>
|
||||||
draw: function(event, can, point) {
|
draw: function(event, can, point) {
|
||||||
if (point.length == 1) { can._temp = {} }
|
if (point.length == 1) { can._temp = {} }
|
||||||
@ -459,8 +456,7 @@ Volcanos("onfigure", {help: "图形绘制", list: [],
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
circle: {
|
circle: {
|
||||||
data: { size: {x: "cx", y: "cy", width: "r", height: "r"},
|
data: { size: {x: "cx", y: "cy", width: "r", height: "r"}, copy: ["r"],
|
||||||
copy: ["r"],
|
|
||||||
}, // <circle cx="25" cy="75" r="20"/>
|
}, // <circle cx="25" cy="75" r="20"/>
|
||||||
draw: function(event, can, point) { if (point.length < 2) { return }
|
draw: function(event, can, point) { if (point.length < 2) { return }
|
||||||
var p0 = point[0], p1 = point[1]; var data = {
|
var p0 = point[0], p1 = point[1]; var data = {
|
||||||
@ -480,8 +476,7 @@ Volcanos("onfigure", {help: "图形绘制", list: [],
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
ellipse: {
|
ellipse: {
|
||||||
data: { size: {x: "cx", y: "cy", width: "rx", height: "ry"},
|
data: { size: {x: "cx", y: "cy", width: "rx", height: "ry"}, copy: ["rx", "ry"],
|
||||||
copy: ["rx", "ry"],
|
|
||||||
}, // <ellipse cx="75" cy="75" rx="20" ry="5"/>
|
}, // <ellipse cx="75" cy="75" rx="20" ry="5"/>
|
||||||
draw: function(event, can, point) { if (point.length < 2) { return }
|
draw: function(event, can, point) { if (point.length < 2) { return }
|
||||||
var p0 = point[0], p1 = point[1]; var data = {
|
var p0 = point[0], p1 = point[1]; var data = {
|
||||||
@ -501,8 +496,7 @@ Volcanos("onfigure", {help: "图形绘制", list: [],
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
block: {
|
block: {
|
||||||
data: { size: {x: "x", y: "y"}, rx: 4, ry: 4,
|
data: { size: {x: "x", y: "y"}, rx: 4, ry: 4, copy: ["width", "height", "rx", "ry"],
|
||||||
copy: ["width", "height", "rx", "ry"],
|
|
||||||
}, // <rect x="60" y="10" rx="10" ry="10" width="30" height="30" rx="4" ry="4"/>
|
}, // <rect x="60" y="10" rx="10" ry="10" width="30" height="30" rx="4" ry="4"/>
|
||||||
draw: function(event, can, point) { if (point.length < 2) { return }
|
draw: function(event, can, point) { if (point.length < 2) { return }
|
||||||
this._temp && can.page.Remove(can, this._temp) && delete(this._temp)
|
this._temp && can.page.Remove(can, this._temp) && delete(this._temp)
|
||||||
@ -688,6 +682,7 @@ Volcanos("onaction", {help: "组件菜单", list: ["", "项目", "保存", "",
|
|||||||
if (pos == 5) {
|
if (pos == 5) {
|
||||||
can.Action("mode", "draw")
|
can.Action("mode", "draw")
|
||||||
can.Action("shape", "rect")
|
can.Action("shape", "rect")
|
||||||
|
can.page.Modify(can, can.svg, {style: {cursor: "crosshair"}})
|
||||||
} else {
|
} else {
|
||||||
can.Action("mode", "resize")
|
can.Action("mode", "resize")
|
||||||
}
|
}
|
||||||
@ -711,7 +706,7 @@ Volcanos("onaction", {help: "组件菜单", list: ["", "项目", "保存", "",
|
|||||||
}
|
}
|
||||||
var target = event.target
|
var target = event.target
|
||||||
if (event.altKey) {
|
if (event.altKey) {
|
||||||
target = can.onfigure._copy(can, event.target)
|
target = can.onfigure._copy(event, can, event.target)
|
||||||
can.Action("mode", "resize")
|
can.Action("mode", "resize")
|
||||||
}
|
}
|
||||||
if (event.target == can._target) { return }
|
if (event.target == can._target) { return }
|
||||||
@ -740,7 +735,7 @@ Volcanos("ondetail", {help: "组件详情", list: ["复制", "标签", "编辑",
|
|||||||
"删除": function(event, can) { event.target != can.svg && can.page.Remove(can, event.target) },
|
"删除": function(event, can) { event.target != can.svg && can.page.Remove(can, event.target) },
|
||||||
"编辑": function(event, can) { var target = event.target
|
"编辑": function(event, can) { var target = event.target
|
||||||
var figure = can.onfigure._get(can, target)
|
var figure = can.onfigure._get(can, target)
|
||||||
can.user.input(event, can, can.core.List(["x", "y", "text"].concat(figure.data.copy||[]), function(item) {
|
can.user.input(event, can, can.core.List(["x", "y"].concat(figure.data.copy||[]), function(item) {
|
||||||
return {_input: "text", name: item, value: target.Value(item)}
|
return {_input: "text", name: item, value: target.Value(item)}
|
||||||
}), function(event, cmd, meta, list) {
|
}), function(event, cmd, meta, list) {
|
||||||
can.core.Item(meta, function(key, value) {
|
can.core.Item(meta, function(key, value) {
|
||||||
@ -768,7 +763,7 @@ Volcanos("ondetail", {help: "组件详情", list: ["复制", "标签", "编辑",
|
|||||||
}, def)
|
}, def)
|
||||||
},
|
},
|
||||||
"复制": function(event, can) {
|
"复制": function(event, can) {
|
||||||
can.onfigure._copy(can, event.target)
|
can.onfigure._copy(event, can, event.target)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos("onexport", {help: "导出数据", list: ["point", "group", "target", "zone", "type", "name", "keys"],
|
Volcanos("onexport", {help: "导出数据", list: ["point", "group", "target", "zone", "type", "name", "keys"],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user