Skip to content

Commit

Permalink
Merge pull request #269 from PrefectHQ/on-the-fly-bitmap-fonts
Browse files Browse the repository at this point in the history
use on-the-fly bitmap font spritesheets
  • Loading branch information
pleek91 authored Oct 26, 2023
2 parents 791802d + 3fed01f commit ab77e02
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 124 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"cSpell.words": [
"combobox",
"consts",
"fontfaceobserver",
"gsap",
"heroicons",
"isequal",
Expand Down
107 changes: 0 additions & 107 deletions demo/public/fonts/Inter-Regular.fnt

This file was deleted.

Binary file removed demo/public/fonts/atlas.png
Binary file not shown.
24 changes: 24 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"devDependencies": {
"@prefecthq/eslint-config": "1.0.31",
"@types/d3": "7.4.1",
"@types/fontfaceobserver": "^2.1.2",
"@types/lodash.isequal": "4.5.6",
"@types/lodash.merge": "4.6.7",
"@types/node": "^20.1.7",
Expand All @@ -65,6 +66,7 @@
"@pixi-essentials/cull": "2.0.0",
"d3": "7.8.5",
"date-fns": "2.30.0",
"fontfaceobserver": "^2.3.0",
"lodash.isequal": "4.5.0",
"lodash.merge": "4.6.2",
"pixi-viewport": "5.0.2",
Expand Down
4 changes: 1 addition & 3 deletions src/factories/label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ export async function nodeLabelFactory() {
const { inter } = await waitForFonts()
const cull = await waitForLabelCull()

const label = inter('', {
fontSize: 12,
})
const label = inter('')

cull.add(label)

Expand Down
4 changes: 2 additions & 2 deletions src/factories/nodeFlowRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ export async function flowRunContainerFactory(node: RunGraphNode) {

const labelMinLeft = Math.max(barRight, buttonRight)
const inside = barWithoutMargin > labelMinLeft + label.width
const y = bar.height / 2
const yOffset = 0.5
const y = bar.height / 2 - label.height / 2 - yOffset
const x = inside ? labelMinLeft + margin : arrowButton.x + arrowButton.width + margin

label.anchor.set(0, 0.5)
label.position = { x, y }

return label
Expand Down
2 changes: 1 addition & 1 deletion src/factories/nodeTaskRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export async function taskRunContainerFactory() {
// todo: this should probably be nodePadding
const margin = config.styles.nodeMargin
const inside = bar.width > margin + label.width + margin
const y = bar.height / 2 - label.height
const y = bar.height / 2 - label.height / 2

if (inside) {
return {
Expand Down
Loading

0 comments on commit ab77e02

Please sign in to comment.