mirror of
https://shylinux.com/x/volcanos
synced 2025-04-25 16:58:06 +08:00
opt draw
This commit is contained in:
parent
32bed47c72
commit
9504488749
23
frame.js
23
frame.js
@ -469,12 +469,29 @@ Volcanos("onlayout", {help: "页面布局", list: [], _init: function(can, targe
|
|||||||
]}] }])
|
]}] }])
|
||||||
},
|
},
|
||||||
profile: function(can, target) { target = target||can._output
|
profile: function(can, target) { target = target||can._output
|
||||||
|
var gt = "❯", lt = "❮"
|
||||||
|
var down = "˅", up = "˄"
|
||||||
return can.page.Append(can, target, [{view: [chat.LAYOUT, html.TABLE], list: [
|
return can.page.Append(can, target, [{view: [chat.LAYOUT, html.TABLE], list: [
|
||||||
{view: [chat.PROJECT, html.TD], list: [{view: [chat.PROJECT]}]},
|
{view: [chat.PROJECT, html.TD], list: [
|
||||||
|
{view: [chat.PROJECT]},
|
||||||
|
]},
|
||||||
{type: html.TD, list: [
|
{type: html.TD, list: [
|
||||||
{type: html.TR, list: [{type: html.TR, list: [
|
{type: html.TR, list: [{type: html.TR, list: [
|
||||||
{view: [chat.CONTENT, html.TD], list: [{view: [chat.CONTENT]}]},
|
{view: [chat.CONTENT, html.TD], list: [
|
||||||
{view: [chat.PROFILE, html.TD], list: [{view: [chat.PROFILE], style: {display: html.NONE}}]},
|
{view: [chat.CONTENT]},
|
||||||
|
{view: ["toggle project"], list: [{text: [gt, "div"]}], onclick: function(event) {
|
||||||
|
event.target.innerHTML = can.onmotion.toggle(can, can.ui.project)? lt: gt
|
||||||
|
}},
|
||||||
|
{view: ["toggle profile"], list: [{text: [lt, "div"]}], onclick: function(event) {
|
||||||
|
event.target.innerHTML = can.onmotion.toggle(can, can.ui.profile)? gt: lt
|
||||||
|
}},
|
||||||
|
{view: ["toggle display"], list: [{text: [down, "div"]}], onclick: function(event) {
|
||||||
|
event.target.innerHTML = can.onmotion.toggle(can, can.ui.display)? down: up
|
||||||
|
}},
|
||||||
|
]},
|
||||||
|
{view: [chat.PROFILE, html.TD], list: [
|
||||||
|
{view: [chat.PROFILE], style: {display: html.NONE}},
|
||||||
|
]},
|
||||||
]}]},
|
]}]},
|
||||||
{view: [chat.DISPLAY, html.TR], list: [{view: [chat.DISPLAY], style: {display: html.NONE}}]}
|
{view: [chat.DISPLAY, html.TR], list: [{view: [chat.DISPLAY], style: {display: html.NONE}}]}
|
||||||
]}
|
]}
|
||||||
|
18
lib/user.js
18
lib/user.js
@ -64,17 +64,17 @@ Volcanos("user", {help: "用户操作", agent: {
|
|||||||
|
|
||||||
if (typeof text == "function") { text = text.name || "" }
|
if (typeof text == "function") { text = text.name || "" }
|
||||||
return can._trans&&can._trans[text] || can.Conf("trans."+text) || can.Conf("feature._trans."+text) || {
|
return can._trans&&can._trans[text] || can.Conf("trans."+text) || can.Conf("feature._trans."+text) || {
|
||||||
"clear": "清空", "refresh": "刷新",
|
"create": "创建", "remove": "删除", "insert": "添加", "delete": "删除", "modify": "编辑",
|
||||||
"submit": "提交", "cancel": "取消",
|
"list": "查看", "back": "返回", "run": "执行", "done": "完成", "share": "共享",
|
||||||
"create": "创建", "share": "共享",
|
"edit": "编辑", "save": "保存", "copy": "复制", "show": "显示", "hide": "隐藏",
|
||||||
"list": "查看", "back": "返回",
|
"project": "项目", "profile": "详情", "actions": "参数",
|
||||||
"begin": "开始", "end": "结束",
|
|
||||||
"start": "启动", "stop": "停止",
|
"start": "启动", "stop": "停止",
|
||||||
"open": "打开", "close": "关闭",
|
"open": "打开", "close": "关闭",
|
||||||
"run": "执行", "done": "完成",
|
"begin": "开始", "end": "结束",
|
||||||
"remove": "删除",
|
"clear": "清空", "refresh": "刷新",
|
||||||
"hide": "隐藏", "show": "显示",
|
"submit": "提交", "cancel": "取消",
|
||||||
"edit": "编辑", "project": "项目", "actions": "参数",
|
"label": "标签",
|
||||||
}[text]||text
|
}[text]||text
|
||||||
},
|
},
|
||||||
toast: function(can, content, title, duration, progress) {
|
toast: function(can, content, title, duration, progress) {
|
||||||
|
@ -110,6 +110,45 @@ input[name=cmd]:hover {
|
|||||||
background-color:white; color:black;
|
background-color:white; color:black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.layout td.content {
|
||||||
|
position:relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.layout div.toggle>div {
|
||||||
|
display: table-cell;
|
||||||
|
vertical-align: middle;
|
||||||
|
height:95px;
|
||||||
|
color:white;
|
||||||
|
}
|
||||||
|
table.layout div.toggle {
|
||||||
|
position:absolute; top:20%;
|
||||||
|
background:#e1aeae45;
|
||||||
|
height:100px;
|
||||||
|
}
|
||||||
|
table.layout div.toggle.display>div {
|
||||||
|
height:20px; width:100px;
|
||||||
|
text-align:center;
|
||||||
|
color:white;
|
||||||
|
}
|
||||||
|
table.layout div.toggle.display {
|
||||||
|
margin-top:-10px;
|
||||||
|
height:10px; width:100px;
|
||||||
|
position:sticky; left:20%;
|
||||||
|
border-top-left-radius:10px;
|
||||||
|
border-top-right-radius:10px;
|
||||||
|
}
|
||||||
|
table.layout div.toggle.project {
|
||||||
|
left:0px;
|
||||||
|
min-width:10px;
|
||||||
|
border-top-right-radius:10px;
|
||||||
|
border-bottom-right-radius:10px;
|
||||||
|
}
|
||||||
|
table.layout div.toggle.profile {
|
||||||
|
right:0px;
|
||||||
|
min-width:10px;
|
||||||
|
border-top-left-radius:10px;
|
||||||
|
border-bottom-left-radius:10px;
|
||||||
|
}
|
||||||
table.layout {
|
table.layout {
|
||||||
margin:0; border:0; padding:0;
|
margin:0; border:0; padding:0;
|
||||||
border-spacing:0;
|
border-spacing:0;
|
||||||
|
@ -12,6 +12,9 @@ fieldset.inner>div.action div.file.select {
|
|||||||
fieldset.inner>div.output {
|
fieldset.inner>div.output {
|
||||||
color:white;
|
color:white;
|
||||||
}
|
}
|
||||||
|
fieldset.inner div.output div.toggle {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
fieldset.inner>div.output div.project {
|
fieldset.inner>div.output div.project {
|
||||||
font-size:14px; font-family:monospace;
|
font-size:14px; font-family:monospace;
|
||||||
max-width:180px; overflow:auto;
|
max-width:180px; overflow:auto;
|
||||||
|
@ -165,7 +165,7 @@ Volcanos("onaction", {help: "组件交互", list: [
|
|||||||
],
|
],
|
||||||
insertTask: function(event, can, time) { var msg = can.sup.request(event, {begin_time: time})
|
insertTask: function(event, can, time) { var msg = can.sup.request(event, {begin_time: time})
|
||||||
can.user.input(event, can, can.Conf("feature.insert"), function(event, button, data, list) {
|
can.user.input(event, can, can.Conf("feature.insert"), function(event, button, data, list) {
|
||||||
can.run(event, can.base.Simple(ctx.ACTION, mdb.INSERT, "begin_time", time, data), true)
|
can.run(event, can.base.Simple(ctx.ACTION, mdb.INSERT, data, "begin_time", time), true)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
modifyTask: function(event, can, task, key, value) { var msg = can.request(event, task)
|
modifyTask: function(event, can, task, key, value) { var msg = can.request(event, task)
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
fieldset.draw div.output div.content svg {
|
|
||||||
background-color:#1b5b738c;
|
|
||||||
}
|
|
||||||
fieldset.draw div.output {
|
fieldset.draw div.output {
|
||||||
background-color:#1b5b738c;
|
background-color:#1b5b738c;
|
||||||
font-size:20px;
|
font-size:20px;
|
||||||
font-family:monospace;
|
}
|
||||||
|
fieldset.draw div.output div.content svg {
|
||||||
|
background-color:#1b5b738c;
|
||||||
|
}
|
||||||
|
fieldset.draw div.output div.profile div.action div.item {
|
||||||
|
float:left;
|
||||||
|
}
|
||||||
|
fieldset.draw div.output div.display {
|
||||||
|
max-height:400px;
|
||||||
|
overflow:auto;
|
||||||
}
|
}
|
||||||
|
@ -16,13 +16,20 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
item.tagName == html.G && item.Value(html.CLASS) && can.onimport._group(can, item)
|
item.tagName == html.G && item.Value(html.CLASS) && can.onimport._group(can, item)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// 默认参数
|
// 默认参数
|
||||||
can.core.Timer(10, function() { can.core.Item({
|
can.core.Timer(10, function() {
|
||||||
"stroke-width": 2, "stroke": cli.YELLOW, "fill": cli.PURPLE,
|
can.core.Item({
|
||||||
"font-size": "24", "font-family": html.MONOSPACE,
|
"stroke-width": 2, stroke: cli.YELLOW, fill: cli.PURPLE,
|
||||||
"go": ice.RUN, "shape": "rect", "grid": "10",
|
"font-size": 24, "font-family": html.MONOSPACE,
|
||||||
}, function(key, value) { can.svg.Value(key, can.Action(key, can.svg.Value(key)||value)) }) })
|
go: ice.RUN, shape: "rect", grid: 10,
|
||||||
|
}, function(key, value) { can.svg.Value(key, can.Action(key, can.svg.Value(key)||value)) })
|
||||||
|
|
||||||
|
var pid = can.Option("pid")||can.svg.Value("pid"); can.onmotion.hidden(can, can.ui.profile, true)
|
||||||
|
pid && can.page.Select(can, can.svg, ice.PT+pid, function(item) {
|
||||||
|
can.ondetail.run({target: item}, can), can.onimport._profile(can, item)
|
||||||
|
}) || can.onimport._profile(can, can.svg), can.onmotion.hidden(can, can.ui.profile)
|
||||||
|
can.page.Modify(can, can.ui.display, {style: {"min-height": 80, "max-height": can.Conf("height")-can.svg.Val("height")-52}})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
_group: function(can, target) { var name = target.Groups()
|
_group: function(can, target) { var name = target.Groups()
|
||||||
function show(event) { can.group = target
|
function show(event) { can.group = target
|
||||||
@ -33,7 +40,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
return (name || target == can.svg) && can.onappend.item(can, html.ITEM, {name: name||html.SVG}, function(event) { show(event)
|
return (name || target == can.svg) && can.onappend.item(can, html.ITEM, {name: name||html.SVG}, function(event) { show(event)
|
||||||
can.onaction.show(event, can)
|
can.onaction.show(event, can)
|
||||||
}, function(event) {
|
}, function(event) {
|
||||||
can.user.cartes(event, can, can.onaction, [ice.HIDE, ice.SHOW, mdb.CREATE, mdb.REMOVE, cli.CLEAR])
|
can.user.cartes(event, can, can.onaction, [ice.HIDE, ice.SHOW, mdb.CREATE, cli.CLEAR, mdb.REMOVE])
|
||||||
}, can.ui.project)
|
}, can.ui.project)
|
||||||
},
|
},
|
||||||
_block: function(can, target) {
|
_block: function(can, target) {
|
||||||
@ -76,25 +83,27 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
}
|
}
|
||||||
return target
|
return target
|
||||||
},
|
},
|
||||||
_profile: function(can, target, list) { var figure = can.onfigure._get(can, target); list = list||[chat.HEIGHT, chat.WIDTH, html.X, html.Y, "pid", kit.MDB_INDEX, kit.MDB_ARGS]
|
_profile: function(can, target, list) { can.Option("pid", can.onfigure._pid(can, target))
|
||||||
if (!target.Value("pid")) { can.onfigure._pid(can, target) }
|
|
||||||
can.pid && can.page.Cache(can.pid, can.ui.profile, "some"), can.pid = target.Value("pid")
|
can.pid && can.page.Cache(can.pid, can.ui.profile, "some"), can.pid = target.Value("pid")
|
||||||
var cache = can.page.Cache(can.pid, can.ui.profile); if (cache) { return }
|
var cache = can.page.Cache(can.pid, can.ui.profile); if (cache) { return }
|
||||||
|
|
||||||
can.page.Appends(can, can.ui.profile, [{type: html.TABLE, list: [{th: [kit.MDB_KEY, kit.MDB_VALUE]}].concat(can.core.List(list, function(key) {
|
var action = can.page.Append(can, can.ui.profile, [{view: "action"}]).first
|
||||||
|
can.onappend._action(can, can.ondetail.list, action, {_engine: function(event, can, button) {
|
||||||
|
can.ondetail[button]({target: target}, can, button)
|
||||||
|
}})
|
||||||
|
|
||||||
|
var figure = can.onfigure._get(can, target)
|
||||||
|
list = (list||[]).concat(figure.data.copy, [html.X, html.Y, kit.MDB_INDEX, kit.MDB_ARGS])
|
||||||
|
can.page.Append(can, can.ui.profile, [{type: html.TABLE, className: "content", list: [
|
||||||
|
{th: [kit.MDB_KEY, kit.MDB_VALUE]}, {td: [kit.MDB_TYPE, target.tagName]}, {td: ["pid", target.Value("pid")]},
|
||||||
|
].concat(can.core.List(list, function(key) {
|
||||||
return key = figure.data.size[key]||key, {td: [key, target.Value(key)], ondblclick: function(event) {
|
return key = figure.data.size[key]||key, {td: [key, target.Value(key)], ondblclick: function(event) {
|
||||||
can.onmotion.modify(can, event.target, function(event, value, old) {
|
can.onmotion.modify(can, event.target, function(event, value, old) {
|
||||||
target.Value(key, value), can.onfigure._move(can, target)
|
target.Value(key, value), can.onfigure._move(can, target)
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
})) }]), can.onmotion.hidden(can, can.ui.profile, true)
|
})) }])
|
||||||
|
|
||||||
var index = target.Value(kit.MDB_INDEX)
|
|
||||||
index && can.onappend.plugin(can, {type: chat.STORY, index: index, args: target.Value(kit.MDB_ARGS)}, function(sub) {
|
|
||||||
sub.run = function(event, cmds, cb) {
|
|
||||||
can.run(event, can.misc.Concat([ice.RUN, index], cmds), cb, true)
|
|
||||||
}
|
|
||||||
}, can.ui.profile)
|
|
||||||
},
|
},
|
||||||
draw: function(event, can, value) {
|
draw: function(event, can, value) {
|
||||||
var figure = can.onfigure[value.shape]
|
var figure = can.onfigure[value.shape]
|
||||||
@ -102,6 +111,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
can.core.Item(value.style, function(key, value) { data[key] = value })
|
can.core.Item(value.style, function(key, value) { data[key] = value })
|
||||||
var item = can.onfigure._push(can, value.shape, data, can.group||can.svg)
|
var item = can.onfigure._push(can, value.shape, data, can.group||can.svg)
|
||||||
can.core.ItemCB(value, function(key, cb) { item[key] = cb })
|
can.core.ItemCB(value, function(key, cb) { item[key] = cb })
|
||||||
|
can.onimport._block(can, item), can.onfigure._pid(can, item)
|
||||||
return value._init && value._init(item), item
|
return value._init && value._init(item), item
|
||||||
},
|
},
|
||||||
}, ["/plugin/local/wiki/draw.css"])
|
}, ["/plugin/local/wiki/draw.css"])
|
||||||
@ -109,14 +119,11 @@ Volcanos("onfigure", {help: "图形绘制", list: [],
|
|||||||
_get: function(can, item, name) {
|
_get: function(can, item, name) {
|
||||||
return can.onfigure[name]||can.onfigure[item.getAttribute(kit.MDB_NAME)]||can.onfigure[item.tagName]
|
return can.onfigure[name]||can.onfigure[item.getAttribute(kit.MDB_NAME)]||can.onfigure[item.tagName]
|
||||||
},
|
},
|
||||||
_pid: function(can, item) {
|
_pid: function(can, item) { if (item.Value("pid")) { return item.Value("pid") }
|
||||||
var pid = "p"+can.svg.Val(kit.MDB_COUNT, can.svg.Val(kit.MDB_COUNT)+1)
|
var pid = "p"+can.svg.Val(kit.MDB_COUNT, can.svg.Val(kit.MDB_COUNT)+1)
|
||||||
item.Value(html.CLASS, (item.Value(html.CLASS)+ice.SP+item.Value("pid", pid)).trim())
|
item.Value(html.CLASS, (item.Value(html.CLASS)+ice.SP+item.Value("pid", pid)).trim())
|
||||||
return pid
|
return pid
|
||||||
},
|
},
|
||||||
_ship: function(can, target, value) {
|
|
||||||
return target.Value(ice.SHIP, target.Value(ice.SHIP).concat([value]))
|
|
||||||
},
|
|
||||||
_push: function(can, type, data, target) {
|
_push: function(can, type, data, target) {
|
||||||
var item = document.createElementNS("http://www.w3.org/2000/svg", type)
|
var item = document.createElementNS("http://www.w3.org/2000/svg", type)
|
||||||
target.appendChild(can.onimport._block(can, item)), item.Value(data)
|
target.appendChild(can.onimport._block(can, item)), item.Value(data)
|
||||||
@ -157,7 +164,7 @@ Volcanos("onfigure", {help: "图形绘制", list: [],
|
|||||||
data: {points: 2, size: {height: html.R, width: html.R, x: "cx", y: "cy"}, copy: [html.R]},
|
data: {points: 2, size: {height: html.R, width: html.R, x: "cx", y: "cy"}, copy: [html.R]},
|
||||||
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 p0 = point[0], p1 = point[1]
|
||||||
return {r: Math.sqrt(Math.pow(p0.x-p1.x, 2)+Math.pow(p0.y-p1.y, 2)), cx: p0.x, cy: p0.y}
|
return {r: parseInt(Math.sqrt(Math.pow(p0.x-p1.x, 2)+Math.pow(p0.y-p1.y, 2))), cx: p0.x, cy: p0.y}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
ellipse: { // <ellipse ry="5" rx="20" cx="75" cy="75"/>
|
ellipse: { // <ellipse ry="5" rx="20" cx="75" cy="75"/>
|
||||||
@ -185,7 +192,9 @@ Volcanos("onfigure", {help: "图形绘制", list: [],
|
|||||||
this._temp = can.onfigure._push(can, html.G, {}, can.group||can.svg)
|
this._temp = can.onfigure._push(can, html.G, {}, can.group||can.svg)
|
||||||
|
|
||||||
var rect = can.onfigure._push(can, "rect", can.onfigure.rect.draw(event, can, point), this._temp)
|
var rect = can.onfigure._push(can, "rect", can.onfigure.rect.draw(event, can, point), this._temp)
|
||||||
if (event.type == html.CLICK) { delete(this._temp) }
|
if (event.type == html.CLICK) {
|
||||||
|
can.onfigure._pid(can, rect), delete(this._temp)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
text: function(can, data, target) { can.onfigure.rect.text(can, data, target) },
|
text: function(can, data, target) { can.onfigure.rect.text(can, data, target) },
|
||||||
},
|
},
|
||||||
@ -198,8 +207,10 @@ Volcanos("onfigure", {help: "图形绘制", list: [],
|
|||||||
return p.target = target, p.anchor = pos, point
|
return p.target = target, p.anchor = pos, point
|
||||||
},
|
},
|
||||||
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 p0 = point[0], p1 = point[1], ship = []
|
||||||
return {x1: p0.x, y1: p0.y, x2: p1.x, y2: p1.y}
|
p0.target && p0.target.Value && ship.push({pid: p0.target.Value("pid")})
|
||||||
|
p1.target && p1.target.Value && ship.push({pid: p1.target.Value("pid")})
|
||||||
|
return {x1: p0.x, y1: p0.y, x2: p1.x, y2: p1.y, ship: ship}
|
||||||
},
|
},
|
||||||
text: function(can, target, data) { return data.x = (target.Val("x1")+target.Val("x2"))/2, data.y = (target.Val("y1")+target.Val("y2"))/2, data },
|
text: function(can, target, data) { return data.x = (target.Val("x1")+target.Val("x2"))/2, data.y = (target.Val("y1")+target.Val("y2"))/2, data },
|
||||||
show: function(can, target, figure) { return "<("+(target.Val("y2")-target.Val("y1"))+ice.FS+(target.Val("x2")-target.Val("x1"))+")"+can.onexport._position(can, target, figure) },
|
show: function(can, target, figure) { return "<("+(target.Val("y2")-target.Val("y1"))+ice.FS+(target.Val("x2")-target.Val("x1"))+")"+can.onexport._position(can, target, figure) },
|
||||||
@ -247,7 +258,7 @@ Volcanos("onaction", {help: "组件菜单", list: [
|
|||||||
["fill", cli.RED, cli.YELLOW, cli.GREEN, cli.CYAN, cli.BLUE, cli.PURPLE, cli.BLACK, cli.WHITE, "#0000"],
|
["fill", cli.RED, cli.YELLOW, cli.GREEN, cli.CYAN, cli.BLUE, cli.PURPLE, cli.BLACK, cli.WHITE, "#0000"],
|
||||||
["font-size", 12, 16, 18, 24, 32],
|
["font-size", 12, 16, 18, 24, 32],
|
||||||
|
|
||||||
["go", "run", "auto", "manual"],
|
["go", ice.RUN, ice.AUTO, "manual"],
|
||||||
["mode", "draw", "resize"],
|
["mode", "draw", "resize"],
|
||||||
["shape", "text", "circle", "ellipse", "rect", "block", "line"],
|
["shape", "text", "circle", "ellipse", "rect", "block", "line"],
|
||||||
["grid", 1, 2, 3, 4, 5, 10, 20],
|
["grid", 1, 2, 3, 4, 5, 10, 20],
|
||||||
@ -271,6 +282,7 @@ Volcanos("onaction", {help: "组件菜单", list: [
|
|||||||
},
|
},
|
||||||
|
|
||||||
project: function(event, can) { can.onmotion.toggle(can, can.ui.project) },
|
project: function(event, can) { can.onmotion.toggle(can, can.ui.project) },
|
||||||
|
profile: function(event, can) { can.onmotion.toggle(can, can.ui.profile) },
|
||||||
show: function(event, can) { can.onmotion.show(can, {interval: 100, length: 10}, null, can.group) },
|
show: function(event, can) { can.onmotion.show(can, {interval: 100, length: 10}, null, can.group) },
|
||||||
hide: function(event, can) { can.onmotion.hide(can, {interval: 100, length: 10}, null, can.group) },
|
hide: function(event, can) { can.onmotion.hide(can, {interval: 100, length: 10}, null, can.group) },
|
||||||
create: function(event, can) {
|
create: function(event, can) {
|
||||||
@ -300,9 +312,8 @@ Volcanos("onaction", {help: "组件菜单", list: [
|
|||||||
event.type == html.CLICK && point.length === figure.data.points && (can.point = [])
|
event.type == html.CLICK && point.length === figure.data.points && (can.point = [])
|
||||||
|
|
||||||
if (event.type == html.CLICK && item) {
|
if (event.type == html.CLICK && item) {
|
||||||
var pid = can.onfigure._pid(can, item)
|
var pid = can.onfigure._pid(can, item); can.core.List(point, function(p, i) { if (!p.target) { return }
|
||||||
can.core.List(point, function(p, i) {
|
p.target.Value(ice.SHIP, p.target.Value(ice.SHIP).concat([{pid: pid, which: i+1, anchor: p.anchor}]))
|
||||||
p.target && can.onfigure._ship(can, p.target, {pid: pid, which: i+1, anchor: p.anchor})
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return item
|
return item
|
||||||
@ -369,21 +380,45 @@ Volcanos("onaction", {help: "组件菜单", list: [
|
|||||||
can.onaction._figure(event, can, can.point.concat(point))
|
can.onaction._figure(event, can, can.point.concat(point))
|
||||||
},
|
},
|
||||||
onclick: function(event, can) { var point = can.onexport._point(event, can)
|
onclick: function(event, can) { var point = can.onexport._point(event, can)
|
||||||
if (can.Action("go") == ice.RUN) { return can.onaction._mode.run(event, can) }
|
if (can.Action("go") == ice.RUN) { can.onimport._profile(can, event.target)
|
||||||
|
return event.shiftKey? can.onaction._mode.run(event, can): can.ondetail.run(event, can)
|
||||||
|
}
|
||||||
can.onaction._figure(event, can, can.point = can.point.concat(point))
|
can.onaction._figure(event, can, can.point = can.point.concat(point))
|
||||||
},
|
},
|
||||||
ondblclick: function(event, can) {
|
ondblclick: function(event, can) {
|
||||||
if (can.Action("go") == ice.RUN) { return }
|
|
||||||
can.ondetail.label(event, can)
|
can.ondetail.label(event, can)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos("ondetail", {help: "组件详情", list: [ice.RUN, ice.COPY, html.LABEL, mdb.MODIFY, mdb.DELETE],
|
Volcanos("ondetail", {help: "组件详情", list: [cli.START, ice.RUN, ice.COPY, html.LABEL, mdb.MODIFY, mdb.DELETE],
|
||||||
|
start: function(event, can) { var target = event.target
|
||||||
|
var list = [target], dict = {}
|
||||||
|
for (var i = 0; i < list.length; i++) { var ship = list[i].Value("ship")
|
||||||
|
for (var j = 0; j < ship.length; j++) { var pid = ship[j].pid
|
||||||
|
can.page.Select(can, can.svg, ice.PT+pid, function(item) {
|
||||||
|
var pid = item.Value("ship")[1].pid
|
||||||
|
can.page.Select(can, can.svg, ice.PT+pid, function(item) {
|
||||||
|
!dict[pid] && list.push(item), dict[pid] = true
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
can.core.Next(list, function(item, next) { can.core.Timer(3000, function() {
|
||||||
|
can.onmotion.show(can, {interval: 300, length: 10}, null, item)
|
||||||
|
can.user.toast(can, item.Value("index"))
|
||||||
|
can.ondetail.run({target: item}, can), next()
|
||||||
|
}) })
|
||||||
|
},
|
||||||
run: function(event, can) { var target = event.target
|
run: function(event, can) { var target = event.target
|
||||||
can.run(event, [ice.RUN, event.target.Value(kit.MDB_INDEX)].concat(can.base.Obj(target.Value(kit.MDB_ARGS))), function(msg) {
|
if (!target.Value("pid")) { can.onfigure._pid(can, target) }
|
||||||
can.onappend.table(can, msg, null, can.ui.display)
|
can._pid && can.page.Cache(can._pid, can.ui.display, "some"), can._pid = target.Value("pid")
|
||||||
can.onappend.board(can, msg, can.ui.display)
|
var cache = can.page.Cache(can._pid, can.ui.display); if (cache) { return }
|
||||||
can.onmotion.hidden(can, can.ui.display, true)
|
|
||||||
}, true)
|
can.onmotion.clear(can, can.ui.display), can.svg.Value("pid", target.Value("pid"))
|
||||||
|
var index = target.Value(kit.MDB_INDEX); index && can.onappend.plugin(can, {type: chat.STORY, index: index, args: target.Value(kit.MDB_ARGS)}, function(sub) {
|
||||||
|
sub.Conf("height", can.Conf("height")-can.svg.Val("height")-52), sub.Conf("width", can.Conf("width"))
|
||||||
|
sub.run = function(event, cmds, cb) { can.run(event, can.misc.Concat([ice.RUN, index], cmds), cb, true) }
|
||||||
|
can.onmotion.hidden(can, sub._legend), can.onmotion.hidden(can, can.ui.display, true)
|
||||||
|
}, can.ui.display)
|
||||||
},
|
},
|
||||||
copy: function(event, can) { can.onfigure._copy(event, can, event.target) },
|
copy: function(event, can) { can.onfigure._copy(event, can, event.target) },
|
||||||
label: function(event, can) { var target = event.target
|
label: function(event, can) { var target = event.target
|
||||||
@ -419,11 +454,12 @@ Volcanos("ondetail", {help: "组件详情", list: [ice.RUN, ice.COPY, html.LABEL
|
|||||||
can.page.Remove(can, target)
|
can.page.Remove(can, target)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
Volcanos("onexport", {help: "导出数据", list: ["group", "figure", "pos"],
|
Volcanos("onexport", {help: "导出数据", list: ["group", "figure", "index", "pos"],
|
||||||
_show: function(can, target) { var figure = can.onfigure._get(can, target)
|
_show: function(can, target) { var figure = can.onfigure._get(can, target)
|
||||||
function show() { return can.onexport._size(can, target, figure)+ice.SP+can.onexport._position(can, target, figure) }
|
function show() { return can.onexport._size(can, target, figure)+ice.SP+can.onexport._position(can, target, figure) }
|
||||||
can.Status("figure", target.tagName+ice.SP+(figure? (figure.show||show)(can, target, figure): ""))
|
can.Status("figure", target.tagName+":"+target.Value("pid")+ice.SP+(figure? (figure.show||show)(can, target, figure): ""))
|
||||||
can.Status("group", target.Groups()||can.group.Groups()||html.SVG)
|
can.Status("group", target.Groups()||can.group.Groups()||html.SVG)
|
||||||
|
can.Status("index", target.Value("index"))
|
||||||
},
|
},
|
||||||
_size: function(can, target, figure) { var size = figure.data.size||{}
|
_size: function(can, target, figure) { var size = figure.data.size||{}
|
||||||
return "<("+target.Val(size[chat.HEIGHT]||chat.HEIGHT)+ice.FS+target.Val(size[chat.WIDTH]||chat.WIDTH)+")"
|
return "<("+target.Val(size[chat.HEIGHT]||chat.HEIGHT)+ice.FS+target.Val(size[chat.WIDTH]||chat.WIDTH)+")"
|
||||||
@ -445,7 +481,7 @@ Volcanos("onexport", {help: "导出数据", list: ["group", "figure", "pos"],
|
|||||||
|
|
||||||
content: function(can, svg) {
|
content: function(can, svg) {
|
||||||
return ['<svg vertion="1.1" xmlns="https://www.w3.org/2000/svg" text-anchor="middle" dominant-baseline="middle"'].concat(
|
return ['<svg vertion="1.1" xmlns="https://www.w3.org/2000/svg" text-anchor="middle" dominant-baseline="middle"'].concat(
|
||||||
svg? can.core.List([chat.HEIGHT, chat.WIDTH, kit.MDB_COUNT, "grid", html.STROKE_WIDTH, html.STROKE, html.FILL, html.FONT_SIZE], function(item) {
|
svg? can.core.List([chat.HEIGHT, chat.WIDTH, kit.MDB_COUNT, "pid", "grid", html.STROKE_WIDTH, html.STROKE, html.FILL, html.FONT_SIZE], function(item) {
|
||||||
return svg.Value(item)? ice.SP + item + '="' + svg.Value(item) + '"': ""
|
return svg.Value(item)? ice.SP + item + '="' + svg.Value(item) + '"': ""
|
||||||
}): [" height="+((can.Conf(chat.HEIGHT)||450)-50)+" width="+(can.Conf(chat.WIDTH)||600)]).concat(['>', svg? svg.innerHTML: "", "</svg>"]).join("")
|
}): [" height="+((can.Conf(chat.HEIGHT)||450)-50)+" width="+(can.Conf(chat.WIDTH)||600)]).concat(['>', svg? svg.innerHTML: "", "</svg>"]).join("")
|
||||||
},
|
},
|
||||||
|
@ -20,7 +20,7 @@ Volcanos("heart", {help: "心形", list: [],
|
|||||||
return target.Val("yy")+tt.ty
|
return target.Val("yy")+tt.ty
|
||||||
},
|
},
|
||||||
}, // <heart cx="25" cy="75" r="20"/>
|
}, // <heart 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], p2 = point[2];
|
var p0 = point[0], p1 = point[1], p2 = point[2];
|
||||||
pl = {x: 2*p0.x - p1.x, y:2*p0.y-p1.y}
|
pl = {x: 2*p0.x - p1.x, y:2*p0.y-p1.y}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Volcanos("onfigure", {help: "图形绘制", list: [],
|
Volcanos("onfigure", {help: "图形绘制", list: [],
|
||||||
path: { // <path d="M10 10 H 90 V 90 H 10 Z" stroke="black" fill="transparent"/>
|
path: { // <path d="M10 10 H 90 V 90 H 10 Z"/>
|
||||||
data: {size: {}, copy: ["d", "name", "meta", "tt", "xx", "yy"],
|
data: {size: {}, copy: ["d", "tt", "xx", "yy"],
|
||||||
x: function(event, can, value, cmd, target) {
|
x: function(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) {
|
||||||
tt.tx = value-target.Val("xx")
|
tt.tx = value-target.Val("xx")
|
||||||
@ -10,7 +10,7 @@ Volcanos("onfigure", {help: "图形绘制", list: [],
|
|||||||
}
|
}
|
||||||
return target.Val("xx")+tt.tx
|
return target.Val("xx")+tt.tx
|
||||||
},
|
},
|
||||||
y: function(event, can, value, cmd, target) {
|
y: function(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) {
|
||||||
tt.ty = value-target.Val("yy")
|
tt.ty = value-target.Val("yy")
|
||||||
@ -23,7 +23,7 @@ Volcanos("onfigure", {help: "图形绘制", list: [],
|
|||||||
draw: function(event, can, point, style) {
|
draw: function(event, can, point, style) {
|
||||||
if (style && style.d) { return style }
|
if (style && style.d) { return style }
|
||||||
if (point.length == 1) { can._temp = {} }
|
if (point.length == 1) { can._temp = {} }
|
||||||
if (point.length < 2) {return}
|
if (point.length < 2) { return }
|
||||||
|
|
||||||
if (can.keys && can.keys.length > 0) { var k;
|
if (can.keys && can.keys.length > 0) { var k;
|
||||||
k = can._temp[point.length-1] = can.keys[0]
|
k = can._temp[point.length-1] = can.keys[0]
|
||||||
|
@ -4,6 +4,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
var r = 200, margin = 20; can.svg.Val(chat.WIDTH, 2*(r+margin)), can.svg.Val(chat.HEIGHT, 2*(r+margin))
|
var r = 200, margin = 20; can.svg.Val(chat.WIDTH, 2*(r+margin)), can.svg.Val(chat.HEIGHT, 2*(r+margin))
|
||||||
can.onimport._draw(can, msg, "value", r+margin, r+margin, r, margin, 0)
|
can.onimport._draw(can, msg, "value", r+margin, r+margin, r, margin, 0)
|
||||||
can.onmotion.clear(can, can.ui.project), can.onappend.table(can, msg, null, can.ui.project)
|
can.onmotion.clear(can, can.ui.project), can.onappend.table(can, msg, null, can.ui.project)
|
||||||
|
can.onmotion.hidden(can, can.ui.project, true)
|
||||||
can.page.Modify(can, can.ui.project, {style: {"max-width": 480}})
|
can.page.Modify(can, can.ui.project, {style: {"max-width": 480}})
|
||||||
can.page.Select(can, can.ui.project, html.TR, function(tr, index) {
|
can.page.Select(can, can.ui.project, html.TR, function(tr, index) {
|
||||||
can.page.Modify(can, tr, {onmouseenter: function(event) {
|
can.page.Modify(can, tr, {onmouseenter: function(event) {
|
||||||
@ -24,14 +25,19 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
"stroke-width": 1, stroke: color, fill: color, d: join([
|
"stroke-width": 1, stroke: color, fill: color, d: join([
|
||||||
["M", x, y], ["L"].concat(pos(x, y, r, begin)), ["A", r, r, "0 0 1"].concat(pos(x, y, r, begin+span)), ["Z"]
|
["M", x, y], ["L"].concat(pos(x, y, r, begin)), ["A", r, r, "0 0 1"].concat(pos(x, y, r, begin+span)), ["Z"]
|
||||||
]),
|
]),
|
||||||
}, onmouseenter: function(event) { can.base.isFunc(cb) && cb(event)} }) }
|
}, onmouseenter: function(event) {
|
||||||
|
can.base.isFunc(cb) && cb(event)
|
||||||
|
} }) }
|
||||||
|
|
||||||
var total = 0; msg.Table(function(value) { total += parseInt(value[field]) })
|
var total = 0; msg.Table(function(value) { total += parseInt(value[field]) })
|
||||||
var color = [cli.RED, cli.YELLOW, cli.GREEN, cli.CYAN, cli.BLUE, cli.PURPLE, cli.WHITE, cli.BLACK]
|
var color = [cli.RED, cli.YELLOW, cli.GREEN, cli.CYAN, cli.BLUE, cli.PURPLE, cli.WHITE, cli.BLACK]
|
||||||
var begin = 0; msg["color"] = [], msg["weight"] = [], msg.Table(function(value, index) { var span = parseInt(value[field])/total*360
|
var begin = 0; msg["color"] = [], msg["weight"] = [], msg.Table(function(value, index) { var span = parseInt(value[field])/total*360
|
||||||
var p = index==which? pos(x, y, margin, begin+span/2): [x, y]; index == which && can.Status(value)
|
var p = index==which? pos(x, y, margin, begin+span/2): [x, y]; index == which && can.Status(value)
|
||||||
var c = color[index%color.length]; pie(p[0], p[1], r, begin, span, c, function(event) {
|
var c = color[index%color.length]; pie(p[0], p[1], r, begin, span, c, function(event) {
|
||||||
can.onmotion.clear(can, can.svg), can.onimport._draw(can, msg, field, x, y, r, margin, index)
|
if (index == can._last) { return } can._last = index
|
||||||
|
can.onmotion.clear(can, can.svg), can.svg.Value("count", 0)
|
||||||
|
can.onimport._draw(can, msg, field, x, y, r, margin, index)
|
||||||
|
can.onimport._profile(can, event.target)
|
||||||
}), begin += span, msg.Push("color", '<span style="background-color:'+c+'"> </span>')
|
}), begin += span, msg.Push("color", '<span style="background-color:'+c+'"> </span>')
|
||||||
msg.Push("weight", parseInt(parseInt(value[field])*10000/total)/100+"%")
|
msg.Push("weight", parseInt(parseInt(value[field])*10000/total)/100+"%")
|
||||||
})
|
})
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
fieldset.inner.float {
|
fieldset.draw.spide div.output {
|
||||||
/* background-color:#332f1ecf; */
|
font-family:monospace;
|
||||||
|
}
|
||||||
|
fieldset.draw.spide div.output div.toggle {
|
||||||
|
display:none;
|
||||||
}
|
}
|
||||||
fieldset.inner.float div.output {
|
fieldset.inner.float div.output {
|
||||||
background-color:#332f1ecf;
|
background-color:#332f1ecf;
|
||||||
/* max-width:800px; */
|
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ Volcanos("onimport", {help: "导入数据", list: [], _init: function(can, msg,
|
|||||||
})
|
})
|
||||||
can.Status({"from": begin, "commit": count, "total": add+del, "max": max})
|
can.Status({"from": begin, "commit": count, "total": add+del, "max": max})
|
||||||
},
|
},
|
||||||
})
|
}, [""])
|
||||||
Volcanos("onaction", {help: "组件菜单", list: ["编辑", ["view", "趋势图", "柱状图", "数据源"], ["height", "100", "200", "400", "600", "800", "max"], ["speed", "10", "20", "50", "100"]],
|
Volcanos("onaction", {help: "组件菜单", list: ["编辑", ["view", "趋势图", "柱状图", "数据源"], ["height", "100", "200", "400", "600", "800", "max"], ["speed", "10", "20", "50", "100"]],
|
||||||
"编辑": function(event, can) {
|
"编辑": function(event, can) {
|
||||||
can.onmotion.toggle(can, can._action)
|
can.onmotion.toggle(can, can._action)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user