forked from x/icebergs
opt draw
This commit is contained in:
parent
2794463664
commit
8a8e06cd10
@ -26,7 +26,7 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
can.onappend._status(can, can.base.Obj(msg.Option(ice.MSG_STATUS)))
|
can.onappend._status(can, can.base.Obj(msg.Option(ice.MSG_STATUS)))
|
||||||
can.core.Item(can.db.list, function(key, item) { if (item.prev) { item.prev = can.db.list[item.prev] } if (item.from) { item.from = can.db.list[item.from] } })
|
can.core.Item(can.db.list, function(key, item) { if (item.prev) { item.prev = can.db.list[item.prev] } if (item.from) { item.from = can.db.list[item.from] } })
|
||||||
can.onappend.plugin(can, {index: web.WIKI_DRAW, display: "/plugin/local/wiki/draw.js", style: html.OUTPUT}, function(sub) { can.ui.toggle = can.onappend.toggle(can, can.ui.content)
|
can.onappend.plugin(can, {index: web.WIKI_DRAW, display: "/plugin/local/wiki/draw.js", style: html.OUTPUT}, function(sub) { can.ui.toggle = can.onappend.toggle(can, can.ui.content)
|
||||||
sub.onexport.output = function(_sub, _msg) { sub.Action(svg.GO, "manual"), sub.Action(ice.MODE, web.RESIZE), can.onmotion.hidden(can, _sub._action), can.db._content_plugin = _sub
|
sub.onexport.output = function(_sub, _msg) { sub.Action(svg.GO, "manual"), sub.Action(ice.MODE, html.RESIZE), can.onmotion.hidden(can, _sub._action), can.db._content_plugin = _sub
|
||||||
can.onimport.layout(can), can.onimport._flows(can, _sub)
|
can.onimport.layout(can), can.onimport._flows(can, _sub)
|
||||||
}, sub.run = function(event, cmds, cb) { cb(can.request(event)) }
|
}, sub.run = function(event, cmds, cb) { cb(can.request(event)) }
|
||||||
}, can.ui.content)
|
}, can.ui.content)
|
||||||
@ -40,7 +40,7 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
}, can.ui.profile)
|
}, can.ui.profile)
|
||||||
},
|
},
|
||||||
_flows: async function(can, _sub) { var margin = can.onexport.margin(can), height = can.onexport.height(can), width = can.onexport.width(can)
|
_flows: async function(can, _sub) { var margin = can.onexport.margin(can), height = can.onexport.height(can), width = can.onexport.width(can)
|
||||||
var matrix = {}, horizon = can.Action("direct") == "horizon"; can.onmotion.clear(can, _sub.svg), can.db._height = 0, can.db._width = 0
|
var matrix = {}, horizon = can.Action("direct") == "horizon"; can.onmotion.clear(can, _sub.ui.svg), can.db._height = 0, can.db._width = 0
|
||||||
async function sleep() { return new Promise(resolve => { setTimeout(resolve, can.Action("delay")) }) }
|
async function sleep() { return new Promise(resolve => { setTimeout(resolve, can.Action("delay")) }) }
|
||||||
async function show(item, main) { var prev = "from", from = "prev"; if (horizon) { var prev = "prev", from = "from" }
|
async function show(item, main) { var prev = "from", from = "prev"; if (horizon) { var prev = "prev", from = "from" }
|
||||||
while (matrix[can.core.Keys(item.x, item.y)]) {
|
while (matrix[can.core.Keys(item.x, item.y)]) {
|
||||||
@ -88,7 +88,7 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
if (can.page.isDisplay(can.ui.profile)) { var profile = can.db._profile_plugin; can.page.styleWidth(can, can.ui.profile, (can.ConfWidth()-can.ui.project.offsetWidth)/2) }
|
if (can.page.isDisplay(can.ui.profile)) { var profile = can.db._profile_plugin; can.page.styleWidth(can, can.ui.profile, (can.ConfWidth()-can.ui.project.offsetWidth)/2) }
|
||||||
can.page.isDisplay(can.ui.display) && can.page.SelectChild(can, can.ui.display, html.TABLE, function(target) { can.page.styleHeight(can, can.ui.display, can.base.Max(target.offsetHeight, can.ConfHeight()/2)+1) })
|
can.page.isDisplay(can.ui.display) && can.page.SelectChild(can, can.ui.display, html.TABLE, function(target) { can.page.styleHeight(can, can.ui.display, can.base.Max(target.offsetHeight, can.ConfHeight()/2)+1) })
|
||||||
can.ui.layout(can.ConfHeight(), can.ConfWidth(), 0, function(height, width) { can.ui.toggle && can.ui.toggle.layout()
|
can.ui.layout(can.ConfHeight(), can.ConfWidth(), 0, function(height, width) { can.ui.toggle && can.ui.toggle.layout()
|
||||||
var _sub = can.db._content_plugin; if (_sub) { _sub.sup.onimport.size(_sub.sup, height, width), _sub.svg.Val(html.HEIGHT, can.db._height), _sub.svg.Val(html.WIDTH, can.db._width) }
|
var _sub = can.db._content_plugin; if (_sub) { _sub.sup.onimport.size(_sub.sup, height, width), _sub.ui.svg.Val(html.HEIGHT, can.db._height), _sub.ui.svg.Val(html.WIDTH, can.db._width) }
|
||||||
profile && profile.onimport.size(profile, can.ui.profile.offsetHeight, can.ui.profile.offsetWidth-1, true)
|
profile && profile.onimport.size(profile, can.ui.profile.offsetHeight, can.ui.profile.offsetWidth-1, true)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -3,8 +3,8 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
can.onmotion.hidden(can, can._status), can.base.isFunc(cb) && cb(msg)
|
can.onmotion.hidden(can, can._status), can.base.isFunc(cb) && cb(msg)
|
||||||
can.onmotion.hidden(can, can._action), can.onimport._show(can)
|
can.onmotion.hidden(can, can._action), can.onimport._show(can)
|
||||||
}) },
|
}) },
|
||||||
_show: function(can) { can.svg.Value("dominant-baseline", "middle")
|
_show: function(can) { can.ui.svg.Value("dominant-baseline", "middle")
|
||||||
can.onmotion.clear(can, can.svg), can.svg.Val(html.HEIGHT, can.ConfHeight()), can.svg.Val(html.WIDTH, can.ConfWidth())
|
can.onmotion.clear(can, can.ui.svg), can.ui.svg.Val(html.HEIGHT, can.ConfHeight()), can.ui.svg.Val(html.WIDTH, can.ConfWidth())
|
||||||
var x = can.ConfWidth()/2, y = can.ConfHeight()/2, r = can.base.Max(can.ConfHeight(), can.ConfWidth())/2-80, c = {x: x, y: y}
|
var x = can.ConfWidth()/2, y = can.ConfHeight()/2, r = can.base.Max(can.ConfHeight(), can.ConfWidth())/2-80, c = {x: x, y: y}
|
||||||
function pos(r, angle) { angle -= 90; return {x: x + r * Math.cos(angle * Math.PI / 180), y: y + r * Math.sin(angle * Math.PI / 180)} }
|
function pos(r, angle) { angle -= 90; return {x: x + r * Math.cos(angle * Math.PI / 180), y: y + r * Math.sin(angle * Math.PI / 180)} }
|
||||||
function line(g, c, p) { return can.onimport.draw(can, {shape: svg.LINE, points: [c, p]}, g) }
|
function line(g, c, p) { return can.onimport.draw(can, {shape: svg.LINE, points: [c, p]}, g) }
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/aaa"
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
|
"shylinux.com/x/icebergs/base/lex"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
)
|
)
|
||||||
@ -15,7 +16,7 @@ func init() {
|
|||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
DRAW: {Name: "draw path=src/main.svg pid list save actions", Icon: "Grapher.png", Help: "思维导图", Actions: ice.MergeActions(ice.Actions{
|
DRAW: {Name: "draw path=src/main.svg pid list save actions", Icon: "Grapher.png", Help: "思维导图", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(mdb.RENDER, mdb.CREATE, nfs.SVG, m.PrefixKey())
|
m.Cmd(mdb.RENDER, mdb.CREATE, mdb.Config(m, lex.REGEXP), m.PrefixKey())
|
||||||
}},
|
}},
|
||||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
defer m.Echo("<!DOCTYPE html><html><body>").Echo("</body></html>")
|
defer m.Echo("<!DOCTYPE html><html><body>").Echo("</body></html>")
|
||||||
|
@ -26,9 +26,8 @@ func init() {
|
|||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
FEEL: {Name: "feel path auto upload record1 record2 actions", Icon: "Photos.png", Help: "影音媒体", Actions: ice.MergeActions(ice.Actions{
|
FEEL: {Name: "feel path auto upload record1 record2 actions", Icon: "Photos.png", Help: "影音媒体", Actions: ice.MergeActions(ice.Actions{
|
||||||
web.UPLOAD: {Hand: func(m *ice.Message, arg ...string) {
|
web.UPLOAD: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(nfs.PATH, _feel_path(m, m.Option(nfs.PATH)))
|
|
||||||
up := kit.Simple(m.Optionv(ice.MSG_UPLOAD))
|
up := kit.Simple(m.Optionv(ice.MSG_UPLOAD))
|
||||||
m.Cmdy(web.CACHE, web.WATCH, m.Option(mdb.HASH), path.Join(m.Option(nfs.PATH), up[1]))
|
m.Cmdy(web.CACHE, web.WATCH, m.Option(mdb.HASH), path.Join(m.Option(nfs.PATH, _feel_path(m, m.Option(nfs.PATH))), up[1]))
|
||||||
}},
|
}},
|
||||||
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
nfs.Trash(m, kit.Select(_feel_path(m, m.Option(nfs.PATH)), arg, 0))
|
nfs.Trash(m, kit.Select(_feel_path(m, m.Option(nfs.PATH)), arg, 0))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user