Skip to content

Commit

Permalink
Added support to text stroke
Browse files Browse the repository at this point in the history
  • Loading branch information
kleber-swf committed Apr 19, 2022
1 parent 33842b6 commit 7ae3b54
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
16 changes: 13 additions & 3 deletions src/core/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,13 @@ class EditorClass {
{ name: 'boundsAlignH', typeHint: 'valueList', values: ['left', 'center', 'right'] },
{ name: 'boundsAlignV', typeHint: 'valueList', values: ['top', 'middle', 'bottom'] },
{ name: 'shadowBlur', typeHint: 'number', data: { min: 0, step: 0.1 } },
{ name: 'shadowColor', typeHint: 'cssColor' },
{ name: 'shadowColor', typeHint: 'string' },
{ name: 'shadowOffsetX', typeHint: 'number', data: { min: 0, step: 0.1 } },
{ name: 'shadowOffsetY', typeHint: 'number', data: { min: 0, step: 0.1 } },
{ name: 'shadowFill', typeHint: 'boolean' },
{ name: 'shadowStroke', typeHint: 'boolean' },
{ name: 'stroke', typeHint: 'string' },
{ name: 'strokeThickness', typeHint: 'number', data: { min: 0, step: 0.1 } },
]);

const basicProperties = {
Expand Down Expand Up @@ -145,21 +147,29 @@ class EditorClass {
'fontVariant',
'fontWeight',
'autoRound',
'divider',
'---',
'align',
'wordWrap',
'wordWrapWidth',
'useAdvancedWordWrap',
'divider',
'---',
'padding', /* 'textBounds', */
'boundsAlignH',
'boundsAlignV',
],
},
{
title: 'Effects',
properties: [
'shadowBlur',
'shadowColor',
'shadowOffsetX',
'shadowOffsetY',
'shadowFill',
'---',
'shadowStroke',
'stroke',
'strokeThickness',
],
},
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class CssColorPropertyEditor extends PropertyEditor<string> {

public setInternalValue(value: string) {
// TODO use some Phaser function for this
// TODO validate color names
if (value === null) return;
const hasHash = value.startsWith('#');
const intValue = parseInt(hasHash ? value.substring(1) : value, 16);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class PropertiesInspector extends Inspector {
propertyGroups.forEach(group => {
if (group.title) this.createTitleElement(group.title);
group.properties.forEach(prop => {
if (prop !== 'divider') {
if (prop !== '---') {
this.createEditorForProperty(obj, idata.getInspectableProperty(prop));
} else {
this.createDivider();
Expand Down

0 comments on commit 7ae3b54

Please sign in to comment.