Compare commits

...
Author SHA1 Message Date
autocraft-bot[bot] f032b2c22c Merge pull request #1014 2026-12-01 04:54:09 +00:00
autocraft-bot[bot] a07fb30823 Merge pull request #735 2026-12-01 04:54:05 +00:00
tydude001 500a90c77a Merge main into rpm-soname-requires
main's co-installable Nightly packages (#2350) rename the .desktop, metainfo and doc directory and
drop the mime file. The one-by-one /usr/share list now takes those names from package.sh
(${NFPM_DESK_ID}, ${NFPM_NAME}), which also drops the mime entry when none is staged, as it does
the /usr/lib tree. Packaged from v0.18.1's binaries, stable and Nightly hold the same files as
main's, .rpm and .deb; both install with rpm -U and zypper on Tumbleweed, dnf on Fedora 44 and apt on
Debian 13, without owning /usr/share/mime.
2026-11-25 08:05:27 -06:00
tydude001 f41ae04700 packaging: RPM recommends libX11-xcb and libxkbcommon-x11, so the GUI starts on X11
The GUI opens libX11-xcb.so.1 and libxkbcommon-x11.so.0 at runtime on X11, and its binary also
names libwayland-egl.so.1, but nothing in the RPM asked for them. Fresh Fedora 44, Leap 15.6 and
Tumbleweed installs, with recommendations on, left libxkbcommon-x11 out. Started on X11 (Xvfb) in
Fedora 44 and Leap 15.6, GridCraft then panicked ("Library libxkbcommon-x11.so could not be
loaded"). With only libX11-xcb missing, winit fails to create its event loop
("libX11-xcb.so.1: cannot open shared object file"). All three are now recommended by soname.
libXrandr is dropped: no binary names it.
2026-11-18 07:34:53 -06:00
tydude001 8a9159a401 packaging: RPM recommends the windowing libraries by soname, so they resolve on openSUSE
The recommendations named Fedora's packages (libwayland-client, libX11, libXcursor, libXi, libXrandr),
which openSUSE calls libwayland-client0, libX11-6 and so on, so zypper skipped all five. As sonames,
like the requirements above them, they resolve on both: with recommendations on, as on a desktop
install, Tumbleweed and Leap 15.6 now select all five for the package itself, and Fedora 44 installs
the same five as before.
2026-11-12 14:52:19 -06:00
tydude001 e779415cce packaging: name /usr/share's files one by one, so the RPM doesn't own /usr/share/mime
A tree of /usr/share made the RPM own /usr/share/mime and /usr/share/mime/packages at 0755, which
openSUSE's filesystem package owns at 0555: rpm -U refuses the package, and zypper installs it but
leaves the directory at 0755. This is the layout WordCraft took in storytold/wordcraft#5369.
2026-11-06 12:43:50 -06:00
tydude001 99b600081f Merge main into rpm-soname-requires 2026-11-06 11:47:59 -06:00
Zach BerryandClaude Opus 5.5 996d67c1a6 Move the empty-shape formatting fix to its own change
It is unrelated to the connector default sites; it is now its own change on its own branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 21:55:15 -06:00
Zach BerryandClaude Opus 5.5 f0c4bd6e6f shape.connect: with one site given, the other end is the site closest to it
The facing rule is for when neither site is given; with exactly one given the other end
is the other shape's site closest to it, as it was before the default changed. Test extended.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 21:53:02 -06:00
Zach BerryandClaude Opus 5.5 39d8c5d7dd shape.connect: a tie between sites goes to the lower site index
The default sites follow the direction between the shapes' centres, but an exact diagonal ties a
box's bottom with its right side (and its top with its left), and shapes with one centre tie
every site; the pick then fell to whichever site came last. A tie now goes to the lower index:
an exact diagonal connects bottom to top, and shapes with one centre both take site 0. The
spec says so. Tests for both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 21:24:32 -06:00
Zach BerryandClaude Opus 5.5 0666ef9980 Imports after upstream replaced wildcard imports (#1444)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 21:24:10 -06:00
Zach BerryandClaude Fable 5.1 6cf5280038 shape.connect takes the direction between the shapes' box centres, not the means of their sites
The mean of a shape's connection sites is off its centre when the sites
are not symmetric (a triangle's lie mostly along its base), which pulled
the dominant direction sideways and glued an arrow to a box's side when
the box was mostly below. The centres come from xfrm_of, so placeholders
and tables are measured as drawn.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-05 21:24:10 -06:00
Zach BerryandClaude Fable 5.1 ffcb3fe68a Connector default sites face the other shape; formatting set before the text survives text.set
shape.connect with no sites given picked the closest pair of sites, which for a diagonal neighbour
chose a side site and drew the arrow across the boxes. Each shape now uses the site that faces the
other along the direction between their centres (a box mostly below is left from the bottom),
which is where a person glues an arrow; the params doc says so.

format.size, format.bold, format.color on a shape that has no text yet kept nothing, so the size
vanished when set_text then landed the text. An empty body now keeps that formatting on the
paragraph's end mark and text.set keeps the first run's properties, or those, so the two work in
either order. A test for each.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-05 21:24:10 -06:00
tydude001andClaude Opus 5.5 767221ca06 packaging: RPM requires library sonames, so openSUSE can install it
DeckCraft's RPM requires Fedora package names: `libxkbcommon`, `(vulkan-loader or libglvnd-egl)`,
`alsa-lib`. openSUSE has no `libxkbcommon`, `vulkan-loader` or `libglvnd-egl` package, so zypper
refuses it with `nothing provides 'libxkbcommon'` (exit 4, which the ArtCraft Launcher shows as
"error 4"; storytold/craft-launcher#341).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 12:16:18 -05:00
5 changed files with 129 additions and 25 deletions
+1 -1
View File
@@ -34,7 +34,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Connect Shapes",
[],
None,
"{from: shape id, to: shape id, fromSite?, toSite?: site index (default: the closest pair), id?: existing line to glue (else a new connector), preset?: straightConnector1|bentConnector3|curvedConnector3} → {id}",
"{from: shape id, to: shape id, fromSite?, toSite?: site index (default: with neither given, the sites facing each other along the dominant direction between the shapes, a tie to the lower index; with one given, the closest site of the other shape; a box has 0 top, 1 left, 2 bottom, 3 right; shape.sites lists them), id?: existing line to glue (else a new connector), preset?: straightConnector1|bentConnector3|curvedConnector3} → {id}",
has_slide,
connect
),
+43 -13
View File
@@ -1,4 +1,4 @@
use super::{ColorRef, Fill, Geom, Line, NO_ID_SPACE, Result, Session, Value, bad, bool_or, id_param, json, str_param, usize_param};
use super::{ColorRef, Fill, Geom, Line, NO_ID_SPACE, Result, Session, Value, bad, bool_or, id_param, json, str_param, usize_param, xfrm_of};
pub(super) fn sites(s: &mut Session, p: &Value) -> Result<Value> {
let id = id_param(p, "id", "shape.sites")?.ok_or_else(|| bad("shape.sites", "missing `id`"))?;
@@ -24,20 +24,50 @@ pub(super) fn connect(s: &mut Session, p: &Value) -> Result<Value> {
return Err(bad("shape.connect", "both shapes need connection sites (lines and groups have none)"));
}
let pick = |v: &[deckcraft_geom::Point], key: &str| usize_param(p, key).filter(|i| *i < v.len());
// A site left unsaid is the one facing the other shape along the dominant direction between
// the two (a box mostly below is left from the bottom), which is where a person glues an
// arrow; "the closest pair" chose a side site for a diagonal neighbour and crossed boxes.
// The direction runs between the shapes' box centres: the mean of the sites is off-centre
// for a shape whose sites are not symmetric (a triangle's lie mostly along its base).
// In slide space, as the sites are: a shape inside a group is placed where the group draws it.
let centre = |id| {
crate::connect::locate(&st.doc, &st.selection, st.shapes(), id)
.map(|(sh, to_abs)| to_abs * xfrm_of(&st.doc, &st.selection, sh).center())
.unwrap_or_default()
};
let (ca, cb) = (centre(from), centre(to));
// A tie goes to the lowest site index: an exact diagonal leaves a box from its bottom (site 2,
// before the right side, 3) and enters the other at its top (0, before the left side, 1), and
// shapes with one centre, where every direction is as good, both take site 0.
let facing = |v: &[deckcraft_geom::Point], c: deckcraft_geom::Point, dx: f64, dy: f64| {
let len = dx.hypot(dy).max(1e-9);
let cos: Vec<f64> = v
.iter()
.map(|q| {
let (sx, sy) = (q.x - c.x, q.y - c.y);
(sx * dx + sy * dy) / (sx.hypot(sy).max(1e-9) * len)
})
.collect();
let best = cos.iter().copied().fold(f64::NEG_INFINITY, f64::max);
cos.iter().position(|x| *x >= best - 1e-9).unwrap_or(0)
};
// With one site given, the other end is the site of the other shape closest to it, as before;
// the facing rule is for the case where neither is given.
let closest = |v: &[deckcraft_geom::Point], to: deckcraft_geom::Point| {
let mut best = (f64::MAX, 0);
for (i, q) in v.iter().enumerate() {
let d = (*q - to).hypot();
if d < best.0 {
best = (d, i);
}
}
best.1
};
let (ia, ib) = match (pick(&a, "fromSite"), pick(&b, "toSite")) {
(Some(i), Some(j)) => (i, j),
(fi, fj) => {
let mut best = (f64::MAX, 0, 0);
for (i, pa) in a.iter().enumerate().filter(|(i, _)| fi.is_none_or(|f| f == *i)) {
for (j, pb) in b.iter().enumerate().filter(|(j, _)| fj.is_none_or(|f| f == *j)) {
let d = (*pa - *pb).hypot();
if d < best.0 {
best = (d, i, j);
}
}
}
(best.1, best.2)
}
(Some(i), None) => (i, closest(&b, a[i])),
(None, Some(j)) => (closest(&a, b[j]), j),
(None, None) => (facing(&a, ca, cb.x - ca.x, cb.y - ca.y), facing(&b, cb, ca.x - cb.x, ca.y - cb.y)),
};
let (p0, p1) = (a[ia], b[ib]);
let id = match id_param(p, "id", "shape.connect")? {
+44
View File
@@ -7189,6 +7189,50 @@ fn invalid_slide_index_never_falls_back_to_the_selection_in_export_commands() {
let _ = std::fs::remove_dir_all(&dir);
}
/// G6: with no sites given, shape.connect joins the sites that face each other along the
/// dominant direction between the two shapes (a box mostly below leaves from the bottom), not
/// "the closest pair", which for a diagonal neighbour picked a side site and crossed boxes.
#[test]
fn connector_default_sites_follow_the_dominant_direction() {
let mut s = session();
let a = s.execute("shape.insert", &json!({"preset": "rect", "rect": [0, 0, 100, 50]})).unwrap()["id"].as_u64().unwrap();
let diag = s.execute("shape.insert", &json!({"preset": "rect", "rect": [150, 200, 100, 50]})).unwrap()["id"].as_u64().unwrap();
let r = s.execute("shape.connect", &json!({"from": a, "to": diag})).unwrap();
assert_eq!((r["fromSite"].as_u64(), r["toSite"].as_u64()), (Some(2), Some(0)), "mostly below: bottom → top, not right → left: {r}");
let r = s.execute("shape.connect", &json!({"from": diag, "to": a})).unwrap();
assert_eq!((r["fromSite"].as_u64(), r["toSite"].as_u64()), (Some(0), Some(2)), "and back: top → bottom: {r}");
// The direction runs between the shapes' centres, not between the means of their sites: a
// triangle's sites lie mostly along its base, which pulled the direction sideways and chose
// the box's left site for a box that is mostly below.
let tri = s.execute("shape.insert", &json!({"preset": "triangle", "rect": [400, 0, 100, 100]})).unwrap()["id"].as_u64().unwrap();
let below = s.execute("shape.insert", &json!({"preset": "rect", "rect": [520, 155, 100, 50]})).unwrap()["id"].as_u64().unwrap();
let r = s.execute("shape.connect", &json!({"from": tri, "to": below})).unwrap();
assert_eq!(r["toSite"].as_u64(), Some(0), "centre to centre is mostly down: the box's top, not its left: {r}");
// An exact diagonal ties the bottom with the right side (and the top with the left): the lower
// site index wins, so bottom → top, and top → bottom back.
let p = s.execute("shape.insert", &json!({"preset": "rect", "rect": [0, 300, 100, 50]})).unwrap()["id"].as_u64().unwrap();
let q = s.execute("shape.insert", &json!({"preset": "rect", "rect": [200, 500, 100, 50]})).unwrap()["id"].as_u64().unwrap();
let sites = |s: &mut Session, from: u64, to: u64| {
let r = s.execute("shape.connect", &json!({"from": from, "to": to})).unwrap();
(r["fromSite"].as_u64(), r["toSite"].as_u64())
};
assert_eq!(sites(&mut s, p, q), (Some(2), Some(0)));
assert_eq!(sites(&mut s, q, p), (Some(0), Some(2)));
// Shapes with one centre tie every site: site 0 on both.
let big = s.execute("shape.insert", &json!({"preset": "rect", "rect": [600, 300, 200, 100]})).unwrap()["id"].as_u64().unwrap();
let small = s.execute("shape.insert", &json!({"preset": "rect", "rect": [650, 325, 100, 50]})).unwrap()["id"].as_u64().unwrap();
assert_eq!(sites(&mut s, big, small), (Some(0), Some(0)));
// One site given: the other end is the other shape's site closest to it, as before the facing
// rule (which is for when neither is given). From a's right side (100, 25) the diagonal box's
// top (200, 200) is nearest; to its left side (150, 225), a's bottom (50, 50).
let r = s.execute("shape.connect", &json!({"from": a, "to": diag, "fromSite": 3})).unwrap();
assert_eq!((r["fromSite"].as_u64(), r["toSite"].as_u64()), (Some(3), Some(0)), "fromSite only: {r}");
let r = s.execute("shape.connect", &json!({"from": a, "to": diag, "toSite": 1})).unwrap();
assert_eq!((r["fromSite"].as_u64(), r["toSite"].as_u64()), (Some(2), Some(1)), "toSite only: {r}");
let r = s.execute("shape.connect", &json!({"from": a, "to": diag, "fromSite": 2, "toSite": 3})).unwrap();
assert_eq!((r["fromSite"].as_u64(), r["toSite"].as_u64()), (Some(2), Some(3)), "both given: {r}");
}
#[test]
fn highlight_with_an_invalid_colour_is_rejected_and_keeps_the_highlight() {
let mut s = session();
+34 -10
View File
@@ -44,16 +44,27 @@ overrides:
- mesa-vulkan-drivers
- xdg-desktop-portal
rpm:
# Library sonames rather than package names, so the same requirements resolve on Fedora/RHEL
# and openSUSE (which has no libxkbcommon, vulkan-loader or libglvnd-egl package). The glibc
# floor names libm because the binaries' GLIBC_2.35 symbols (hypot, hypotf) are libm's: RHEL 9's
# glibc 2.34 provides libc.so.6(GLIBC_2.35) through backports, but not this, so it refuses.
depends:
- libxkbcommon
- alsa-lib
- (vulkan-loader or libglvnd-egl)
- libc.so.6()(64bit)
- libm.so.6(GLIBC_2.35)(64bit)
- libgcc_s.so.1()(64bit)
- libxkbcommon.so.0()(64bit)
- (libvulkan.so.1()(64bit) or libEGL.so.1()(64bit))
- libasound.so.2()(64bit)
# The windowing libraries the GUI loads at runtime, by soname too, so the recommendations resolve on
# openSUSE as well. Without libX11-xcb and libxkbcommon-x11 the GUI cannot start on X11.
recommends:
- libwayland-client
- libX11
- libXcursor
- libXi
- libXrandr
- libwayland-client.so.0()(64bit)
- libX11.so.6()(64bit)
- libXcursor.so.1()(64bit)
- libXi.so.6()(64bit)
- libX11-xcb.so.1()(64bit)
- libxkbcommon-x11.so.0()(64bit)
- libwayland-egl.so.1()(64bit)
- mesa-vulkan-drivers
- xdg-desktop-portal
@@ -64,11 +75,24 @@ contents:
- src: ${STAGE}/usr/bin/${NFPM_CLI}
dst: /usr/bin/${NFPM_CLI}
file_info: { mode: 0755 }
# Named one by one rather than as a tree of /usr/share: a tree would also own shared directories
# such as /usr/share/mime, which openSUSE's filesystem package owns with other modes, and RPM
# refuses to install a package that conflicts with it. ${NFPM_DESK_ID} and ${NFPM_NAME} are filled
# in by package.sh (a Nightly renames them), which also drops the mime entry when none is staged.
- src: ${STAGE}/usr/share/applications/${NFPM_DESK_ID}.desktop
dst: /usr/share/applications/${NFPM_DESK_ID}.desktop
- src: ${STAGE}/usr/share/mime/packages/ai.storyteller.deckcraft.xml
dst: /usr/share/mime/packages/ai.storyteller.deckcraft.xml
- src: ${STAGE}/usr/share/metainfo/${NFPM_DESK_ID}.metainfo.xml
dst: /usr/share/metainfo/${NFPM_DESK_ID}.metainfo.xml
- src: ${STAGE}/usr/share/icons/hicolor/
dst: /usr/share/icons/hicolor/
type: tree
- src: ${STAGE}/usr/lib/
dst: /usr/lib/
type: tree
- src: ${STAGE}/usr/share/
dst: /usr/share/
- src: ${STAGE}/usr/share/doc/${NFPM_NAME}/
dst: /usr/share/doc/${NFPM_NAME}/
type: tree
scripts:
+7 -1
View File
@@ -151,6 +151,7 @@ if has deb || has rpm; then
export NFPM_NAME="deckcraft"
export NFPM_BIN="deckcraft"
export NFPM_CLI="deckcraft-cli"
NFPM_DESK_ID="$APP_ID"
if [[ "$IS_NIGHTLY" = 1 ]]; then
NIGHTLY_DESK_ID="$APP_ID.nightly-v1"
NIGHTLY_ICON="$ROOT/assets/app-icon/deckcraft-nightly.png"
@@ -158,6 +159,7 @@ if has deb || has rpm; then
export NFPM_NAME="deckcraft-nightly"
export NFPM_BIN="deckcraft-nightly"
export NFPM_CLI="deckcraft-nightly-cli"
NFPM_DESK_ID="$NIGHTLY_DESK_ID"
NFPM_STAGE="$WORK/nfpm-root"
rm -rf "$NFPM_STAGE"
cp -R "$STAGE" "$NFPM_STAGE"
@@ -192,8 +194,12 @@ if has deb || has rpm; then
DROP_LIB_TREE=
# shellcheck disable=SC2016
[[ -d "$NFPM_STAGE/usr/lib" ]] || DROP_LIB_TREE='\|^ - src: \${STAGE}/usr/lib/|,+2d;'
# nfpm refuses a named file that isn't staged, and a Nightly stages no mime file.
DROP_MIME=
# shellcheck disable=SC2016
sed "${DROP_LIB_TREE}s|\${STAGE}|$NFPM_STAGE|g;s|\${NFPM_BIN}|$NFPM_BIN|g;s|\${NFPM_CLI}|$NFPM_CLI|g" "$HERE/nfpm.yaml" >"$WORK/nfpm.yaml"
[[ -d "$NFPM_STAGE/usr/share/mime" ]] || DROP_MIME='\|^ - src: \${STAGE}/usr/share/mime/|,+1d;'
# shellcheck disable=SC2016
sed "${DROP_LIB_TREE}${DROP_MIME}s|\${STAGE}|$NFPM_STAGE|g;s|\${NFPM_BIN}|$NFPM_BIN|g;s|\${NFPM_CLI}|$NFPM_CLI|g;s|\${NFPM_DESK_ID}|$NFPM_DESK_ID|g;s|\${NFPM_NAME}|$NFPM_NAME|g" "$HERE/nfpm.yaml" >"$WORK/nfpm.yaml"
for fmt in deb rpm; do
if has "$fmt"; then (cd "$ROOT" && nfpm package -f "$WORK/nfpm.yaml" -p "$fmt" -t "$DIST/$BASENAME.$fmt"); fi
done