Skip to content

Commit

Permalink
fix for LVGL widget identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Oct 17, 2024
1 parent 64db4da commit 461cc16
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions packages/project-editor/lvgl/identifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import type { Flow } from "project-editor/flow/flow";
import { Page } from "project-editor/features/page/page";

import type { LVGLWidget } from "project-editor/lvgl/widgets";
import { USER_WIDGET_IDENTIFIER_SEPARATOR } from "project-editor/build/helper";
import {
getName,
NamingConvention,
USER_WIDGET_IDENTIFIER_SEPARATOR
} from "project-editor/build/helper";

export const GENERATED_NAME_PREFIX = "obj";

Expand Down Expand Up @@ -96,7 +100,17 @@ export class LVGLIdentifiers {
if (widget instanceof ProjectEditor.LVGLScreenWidgetClass) {
identifierName = page.name;
} else {
identifierName = prefix + widget.identifier;
if (!widget.identifier) {
return;
}

identifierName =
prefix +
getName(
"",
widget.identifier,
NamingConvention.UnderscoreLowerCase
);
}

if (!identifierName) {
Expand Down

0 comments on commit 461cc16

Please sign in to comment.