Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New API for Text component #303

Closed
3 of 19 tasks
sasha240100 opened this issue Jul 17, 2017 · 2 comments
Closed
3 of 19 tasks

New API for Text component #303

sasha240100 opened this issue Jul 17, 2017 · 2 comments
Assignees
Milestone

Comments

@sasha240100
Copy link
Member

Concept:

new Text({
  font: Text.load('path/to/font.js'),

  geometry: {
    size: 80,
    height: 5,
    curveSegments: 12,
    bevelEnabled: true,
    bevelThickness: 10,
    bevelSize: 8,
    bevelSegments: 5
  },

  // ... 
}).addTo(app);
  • Text.load() - wraps FontLoader in a promise. returns a Promise which is resolved with a THREE.Font.
  • font parameter in Text can accept both: THREE.Font or Promise that resolves it.
    P.s.: It can be implemented simply in API by just keeping async way and wrapping THREE.Font in Promise.resolve(font) if such is passed
Version:
  • v2.x.x
  • v1.x.x
Issue type:
  • Bug
  • Proposal/Enhancement
  • Question
  • Discussion

Tested on:
Desktop
  • Chrome
  • Chrome Canary
  • Chrome dev-channel
  • Firefox
  • Opera
  • Microsoft IE
  • Microsoft Edge
Android
  • Chrome
  • Firefox
  • Opera
IOS
  • Chrome
  • Firefox
  • Opera
@tomriddle1234
Copy link

This is fine for now. However in some frameworks, as pointed by Hirako, loading external json files can cause issue, like Ionic, it can be solved with customized webpack config file.

So maybe, the better way is to leave the loading file/data part to the framework it self that works with WHS.js, this means, the new text API or other similar API should accept a data object as input parameter as well as the existing file-loading scheme.

For example, in Ionic/Angular, the loading becomes subscription to an http request observable, and then whis.js just take the loaded data.

@sasha240100
Copy link
Member Author

@tomriddle1234 The API will still support async because of promise passed. Ok, working on implementation now.

sasha240100 added a commit that referenced this issue Jul 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants