Skip to content

ViewHelper: Make label text and style configurable.#28688

Merged
Mugen87 merged 6 commits intomrdoob:devfrom
puxiao:dev
Jun 21, 2024
Merged

ViewHelper: Make label text and style configurable.#28688
Mugen87 merged 6 commits intomrdoob:devfrom
puxiao:dev

Conversation

@puxiao
Copy link
Copy Markdown
Contributor

@puxiao puxiao commented Jun 18, 2024

Added label text to display configuration items.

#28312 (comment)

class ViewHelper extends Object3D {
-  constructor( camera: Camera, domElement: HTMLElement );
+  constructor( camera: Camera, domElement: HTMLElement, options?: ViewHelperOptions );
}
export interface ViewHelperOptions {
    font?: string  //default value: '24px Arial'
    labelColor?: string //default value: '#000000'
    posXLabel?: string //default value: null (no display)
    posYLabel?: string
    posZLabel?: string
    radius?: number //default value: 14
}

If you want bold text :

{
-   font: '24px Arial',
+   font: 'Bold 24px Arial',
    posXLabel: 'X',
    posYLabel: 'Y',
    posZLabel: 'Z',
}

If you want to display in Chinese :

const viewHelper = new ViewHelper( camera, renderer.domElement, {
    posXLabel: '右',
    posYLabel: '上',
    posZLabel: '前',
    font: 'Bold 24px Arial',
    labelColor: '#000000',
    radius: 20,
} )

Comment thread examples/jsm/helpers/ViewHelper.js Outdated
@Mugen87 Mugen87 added this to the r166 milestone Jun 20, 2024
@Mugen87 Mugen87 changed the title ViewHelper: Add options to the constructor ViewHelper: Make label text and style configurable. Jun 20, 2024
@Mugen87 Mugen87 merged commit 96ba72e into mrdoob:dev Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants