Compare commits

..

No commits in common. "759f77ce3490152de3773e1f59fca0422f64ddde" and "b0950f5e68db7670c444d7bb63bd82e57344aa21" have entirely different histories.

18 changed files with 27 additions and 38 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

View File

@ -30,8 +30,8 @@
#set page(numbering: "1/1", header: align(right)[chronos #sym.dash.em v#chronos.version]) #set page(numbering: "1/1", header: align(right)[chronos #sym.dash.em v#chronos.version])
#set page( #set page(
header: align(left)[chronos #sym.dash.em v#chronos.version], header: locate(loc => align(left)[chronos #sym.dash.em v#chronos.version]),
footer: context align(center, counter(page).display("1/1", both: true)) footer: locate(loc => align(center, counter(page).display("1/1", both: true)))
) )
= Introduction = Introduction

View File

@ -19,15 +19,14 @@
),) ),)
} }
#let _col(p1, p2, width: auto, margin: 0, min-width: 0, max-width: none) = { #let _col(p1, p2, width: auto, margin: 0, min-width: 0) = {
return (( return ((
type: "col", type: "col",
p1: p1, p1: p1,
p2: p2, p2: p2,
width: width, width: width,
margin: margin, margin: margin,
min-width: min-width, min-width: min-width
max-width: max-width
),) ),)
} }
@ -241,6 +240,7 @@
} }
} }
set text(font: "Source Sans 3")
let canvas = render(participants, elmts) let canvas = render(participants, elmts)
fit-canvas(canvas, width: width) fit-canvas(canvas, width: width)
} }

View File

@ -1,4 +1,4 @@
#import "@preview/cetz:0.3.1": draw #import "@preview/cetz:0.2.2": draw
#import "consts.typ": * #import "consts.typ": *
#let _grp(name, desc: none, type: "default", elmts) = { #let _grp(name, desc: none, type: "default", elmts) = {

View File

@ -1,4 +1,4 @@
#let version = version(0, 2, 0) #let version = version(0, 1, 1)
#import "diagram.typ": diagram, from-plantuml, _gap, _evt, _col #import "diagram.typ": diagram, from-plantuml, _gap, _evt, _col
#import "sequence.typ": _seq, _ret #import "sequence.typ": _seq, _ret

View File

@ -1,4 +1,4 @@
#import "@preview/cetz:0.3.1": draw #import "@preview/cetz:0.2.2": draw
#import "consts.typ": * #import "consts.typ": *
#let SIDES = ( #let SIDES = (

View File

@ -1,4 +1,4 @@
#import "@preview/cetz:0.3.1": draw #import "@preview/cetz:0.2.2": draw
#import "consts.typ": * #import "consts.typ": *
#let PAR-SPECIALS = "?[]" #let PAR-SPECIALS = "?[]"

View File

@ -1,4 +1,4 @@
#import "@preview/cetz:0.3.1": canvas, draw #import "@preview/cetz:0.2.2": canvas, draw
#import "utils.typ": get-participants-i, get-style, normalize-units #import "utils.typ": get-participants-i, get-style, normalize-units
#import "group.typ" #import "group.typ"
#import "participant.typ" #import "participant.typ"
@ -218,13 +218,10 @@
if elmt.width != auto { if elmt.width != auto {
widths.at(i) = normalize-units(elmt.width) widths.at(i) = normalize-units(elmt.width)
} }
widths.at(i) = calc.max(
let width = widths.at(i) widths.at(i),
width = calc.max(width, normalize-units(elmt.min-width)) normalize-units(elmt.min-width)
if elmt.max-width != none { ) + normalize-units(elmt.margin)
width = calc.min(width, normalize-units(elmt.max-width))
}
widths.at(i) = width + normalize-units(elmt.margin)
} }
} }

View File

@ -1,4 +1,4 @@
#import "@preview/cetz:0.3.1": draw #import "@preview/cetz:0.2.2": draw
#import "consts.typ": * #import "consts.typ": *
#let _sep(name) = { #let _sep(name) = {

View File

@ -1,4 +1,4 @@
#import "@preview/cetz:0.3.1": draw, vector #import "@preview/cetz:0.2.2": draw, vector
#import "consts.typ": * #import "consts.typ": *
#import "participant.typ" #import "participant.typ"
#import "note.typ" #import "note.typ"
@ -100,27 +100,19 @@
y -= Y-SPACE y -= Y-SPACE
let i1 = pars-i.at(elmt.p1)
let i2 = pars-i.at(elmt.p2)
let width = calc.abs(x-pos.at(i1) - x-pos.at(i2))
let h = 0 let h = 0
let comment = if elmt.comment == none {none} else {
let w = calc.min(width * 1pt, measure(elmt.comment).width)
box(
width: if i1 == i2 {auto} else {w},
elmt.comment
)
}
// Reserve space for comment // Reserve space for comment
if comment != none { if elmt.comment != none {
h = calc.max(h, measure(comment).height / 1pt + 6) h = calc.max(h, measure(box(elmt.comment)).height / 1pt + 6)
} }
if "linked-note" in elmt { if "linked-note" in elmt {
h = calc.max(h, note.get-size(elmt.linked-note).height / 2) h = calc.max(h, note.get-size(elmt.linked-note).height / 2)
} }
y -= h y -= h
let i1 = pars-i.at(elmt.p1)
let i2 = pars-i.at(elmt.p2)
let start-info = ( let start-info = (
i: i1, i: i1,
x: x-pos.at(i1), x: x-pos.at(i1),
@ -252,7 +244,7 @@
(x2, end-info.y) (x2, end-info.y)
) )
if comment != none { if elmt.comment != none {
comment-anchor = ( comment-anchor = (
start: if x-mid < x1 {"south-east"} else {"south-west"}, start: if x-mid < x1 {"south-east"} else {"south-west"},
end: if x-mid < x1 {"south-west"} else {"south-east"}, end: if x-mid < x1 {"south-west"} else {"south-east"},
@ -276,7 +268,7 @@
(x2, end-info.y) (x2, end-info.y)
) )
if comment != none { if elmt.comment != none {
let start-pt = pts.first() let start-pt = pts.first()
let end-pt = pts.last() let end-pt = pts.last()
if elmt.start-tip != "" { if elmt.start-tip != "" {
@ -356,10 +348,10 @@
shapes += draw.line(..pts, ..style) shapes += draw.line(..pts, ..style)
if comment != none { if elmt.comment != none {
shapes += draw.content( shapes += draw.content(
comment-pt, comment-pt,
comment, elmt.comment,
anchor: comment-anchor, anchor: comment-anchor,
angle: comment-angle, angle: comment-angle,
padding: 3pt padding: 3pt

View File

@ -1,7 +1,7 @@
[package] [package]
name = "chronos" name = "chronos"
version = "0.2.0" version = "0.1.1"
compiler = "0.12.0" compiler = "0.11.0"
repository = "https://git.kb28.ch/HEL/chronos" repository = "https://git.kb28.ch/HEL/chronos"
entrypoint = "src/lib.typ" entrypoint = "src/lib.typ"
authors = [ authors = [