Skip to content

Commit

Permalink
add msg for layout too
Browse files Browse the repository at this point in the history
  • Loading branch information
alixander committed Mar 18, 2023
1 parent c71cdf7 commit e9b8c89
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions d2cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,33 @@ func compile(ctx context.Context, ms *xmain.State, plugin d2plugin.Plugin, sketc
if sketch {
opts.FontFamily = go2.Pointer(d2fonts.HandDrawn)
}

t := time.NewTicker(time.Second * 5)
defer t.Stop()
stop := make(chan struct{}, 1)
defer func() {
stop <- struct{}{}
}()

go func() {
for {
select {
case <-t.C:
ms.Log.Info.Printf("compiling & running layout algorithms...")
case <-stop:
ms.Log.Info.Printf("done")
return
}
}
}()

diagram, g, err := d2lib.Compile(ctx, string(input), opts)
if err != nil {
return nil, false, err
}

stop <- struct{}{}

pluginInfo, err := plugin.Info(ctx)
if err != nil {
return nil, false, err
Expand Down
2 changes: 1 addition & 1 deletion lib/png/png.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func ConvertSVG(ms *xmain.State, page playwright.Page, svg []byte) ([]byte, erro
for {
select {
case <-t.C:
ms.Log.Info.Printf("converting to PNG in progress...")
ms.Log.Info.Printf("converting to PNG...")
case <-stop:
return
}
Expand Down

0 comments on commit e9b8c89

Please sign in to comment.