1
0
mirror of https://shylinux.com/x/volcanos synced 2025-04-25 08:48:06 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-05-31 19:57:50 +08:00
parent 8f3c12ee99
commit 50302be95a
2 changed files with 117 additions and 119 deletions

View File

@ -543,33 +543,29 @@ Volcanos(chat.ONEXPORT, {
text: function(can, line) { return can.core.Value(can.page.SelectOne(can, line, "td.text"), "innerText") },
size: function(can, size, full) { if (size > 1) { return size } if (size > 0) { return size*full } },
keys: function(can, path, file) { return [path||can.Option(nfs.PATH), file||can.Option(nfs.FILE)].join(nfs.DF) },
content: function(can) {
var parse = can.onexport.parse(can)
var deep = 0
content: function(can) { var block = "()[]{}", deep = 0, parse = can.onexport.parse(can)
return can.page.Select(can, can.current&&can.current.content||can.ui.content, "td.text", function(item) { var text = item.innerText.trimEnd()
if (parse == "js" && !can.base.beginWith(text, "(")) { var list = []
if (parse == "js" && !can.base.beginWith(text, block[0])) { var list = []
for (var i = 0; i < text.length; i++) {
if (text[i] == "{") {
for (var j = 0; j < block.length; j += 2) {
if (text[i] == block[j]) {
list.push(text[i])
} else if (text[i] == "}") {
if (list[list.length-1] == "{") { list.pop() } else { list.push(text[i]) }
}
if (text[i] == "(") {
break
} else if (text[i] == block[j+1]) {
if (list[list.length-1] == block[j]) {
list.pop()
} else {
list.push(text[i])
} else if (text[i] == ")") {
if (list[list.length-1] == "(") { list.pop() } else { list.push(text[i]) }
}
if (text[i] == "[") {
list.push(text[i])
} else if (text[i] == "]") {
if (list[list.length-1] == "[") { list.pop() } else { list.push(text[i]) }
break
}
}
if (list.indexOf("}") > -1) { deep-- } else if (list.indexOf("]") > -1) { deep-- } else if (list.indexOf(")") > -1) { deep-- }
}
for (var j = 0; j < block.length; j += 2) { if (list.indexOf(block[j+1]) > -1) { deep--; break } }
if (deep < 0) { deep = 0 }
text = "\t".repeat(deep < 0? 0: deep)+text.trimStart()
can.base.beginWith(text, "+") && (text = "\t"+text)
if (list.indexOf("{") > -1) { deep++ } else if (list.indexOf("[") > -1) { deep++ } else if (list.indexOf("(") > -1) { deep++ }
for (var j = 0; j < block.length; j += 2) { if (list.indexOf(block[j]) > -1) { deep++; break } }
}
return text
}).join(lex.NL)

View File

@ -66,8 +66,8 @@ Volcanos(chat.ONIMPORT, {
var target = document.createElementNS("http://www.w3.org/2000/svg", type)
return group.appendChild(can.onimport._block(can, target)), target.Value(value), target
},
group: function(can, name, value, group) { var target = can.onimport.block(can, svg.G, value, group||can.ui.svg)
return target.Value(html.CLASS, name), can.onimport._project(can, target), target
group: function(can, name, value, group) { var target = can.onimport.block(can, svg.G, {}, group||can.ui.svg)
return target.Value(html.CLASS, name), target.Value(value), can.onimport._project(can, target), target
},
draw: function(can, meta, group) { group = group||can.ui.svg
var figure = can.onfigure[meta.shape], data = figure.draw({}, can, meta.points, meta.style||{}); can.core.Item(meta.style, function(key, value) { data[key] = value })
@ -81,7 +81,8 @@ Volcanos(chat.ONIMPORT, {
})
},
})
Volcanos(chat.ONACTION, {list: [
Volcanos(chat.ONACTION, {
list: [
[svg.GO, ctx.RUN, ice.AUTO, "manual"], [ice.MODE, web.DRAW, html.MOVE, html.RESIZE],
[svg.SHAPE, svg.RECT, svg.LINE, svg.TEXT, svg.BLOCK, svg.CIRCLE, svg.ELLIPSE],
[svg.STROKE_WIDTH, svg.STROKE_WIDTH, 1, 2, 3, 4, 5],
@ -253,7 +254,8 @@ Volcanos(chat.ONEXPORT, {list: [svg.GROUP, svg.FIGURE, ctx.INDEX, "pos"],
can.Status(svg.GROUP, target.Groups()||can.ui.group.Groups()||html.SVG)
can.Status(ctx.INDEX, target.Value(ctx.INDEX)||"")
},
content: function(can, target) { return ['<svg xmlns="https://www.w3.org/2000/svg" vertion="1.1" text-anchor="middle" dominant-baseline="middle"'].concat(
content: function(can, target) {
return ['<svg xmlns="https://www.w3.org/2000/svg" vertion="1.1" text-anchor="middle" dominant-baseline="middle"'].concat(
target? can.core.List([mdb.COUNT, svg.PID], function(item) { return target.Value(item)? can.base.joinKV([item, target.Value(item)], mdb.EQ): ""}).join(lex.SP): "").concat([">", target? target.innerHTML: "", "</svg>"]).join("")
},
grid: function(can) { var grid = can.Action(svg.GRID); return grid == svg.GRID || grid == ice.AUTO? 10: grid },