Spaces:
Running
Running
Commit ·
0eec79d
1
Parent(s): bdadca1
Bubble text
Browse files- utils/bubble/Bubble.js +1 -25
- utils/bubble/bubble-templates.js +25 -0
utils/bubble/Bubble.js
CHANGED
|
@@ -21,31 +21,7 @@ const DEFAULT_FONT_FILE = (() => {
|
|
| 21 |
})();
|
| 22 |
|
| 23 |
|
| 24 |
-
|
| 25 |
-
const BaseBubbleTemplates = {
|
| 26 |
-
// Simple text box: black text on white rounded box at top-center
|
| 27 |
-
'simple-top-center': {
|
| 28 |
-
// top-level bubble background controls whether a box is rendered
|
| 29 |
-
backgroundColor: 'white',
|
| 30 |
-
borderRadius: 10,
|
| 31 |
-
bubbleText: {
|
| 32 |
-
fontSize: 48,
|
| 33 |
-
fontColor: '#000000',
|
| 34 |
-
fontName: 'Gill Sans',
|
| 35 |
-
// keep box flag for compatibility (generator will prefer generated rounded background PNG)
|
| 36 |
-
box: 1,
|
| 37 |
-
boxColor: 'white',
|
| 38 |
-
boxBorderW: 10
|
| 39 |
-
},
|
| 40 |
-
bubbleExtra: {
|
| 41 |
-
positionX: 'center',
|
| 42 |
-
positionY: 'top',
|
| 43 |
-
size: 'full',
|
| 44 |
-
paddingX: 2,
|
| 45 |
-
paddingY: 2
|
| 46 |
-
}
|
| 47 |
-
}
|
| 48 |
-
};
|
| 49 |
|
| 50 |
|
| 51 |
class BubbleMaker {
|
|
|
|
| 21 |
})();
|
| 22 |
|
| 23 |
|
| 24 |
+
import { BaseBubbleTemplates } from './bubble-templates.js';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
class BubbleMaker {
|
utils/bubble/bubble-templates.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Base bubble templates (defaults). Templates prefill everything except bubbleText.text for text templates.
|
| 2 |
+
export const BaseBubbleTemplates = {
|
| 3 |
+
// Simple text box: black text on white rounded box at top-center
|
| 4 |
+
'simple-top-center': {
|
| 5 |
+
// top-level bubble background controls whether a box is rendered
|
| 6 |
+
backgroundColor: 'white',
|
| 7 |
+
borderRadius: 10,
|
| 8 |
+
bubbleText: {
|
| 9 |
+
fontSize: 48,
|
| 10 |
+
fontColor: '#000000',
|
| 11 |
+
fontName: 'Arial',
|
| 12 |
+
// keep box flag for compatibility (generator will prefer generated rounded background PNG)
|
| 13 |
+
box: 1,
|
| 14 |
+
boxColor: 'white',
|
| 15 |
+
boxBorderW: 10
|
| 16 |
+
},
|
| 17 |
+
bubbleExtra: {
|
| 18 |
+
positionX: 'center',
|
| 19 |
+
positionY: 'top',
|
| 20 |
+
size: 'full',
|
| 21 |
+
paddingX: 2,
|
| 22 |
+
paddingY: 2
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
};
|