Start a new topic

Is there any way to have a AR.Label take up more than 1 line and wrap?

Is there any way to have a AR.Label take up more than 1 line and wrap?

Hi Eva,

Yes, I am trying to convert my Label code into the HTMLDrawable but I am not able to see any information or object.


I am able to see the details on the Label. 


So I was looking for any sample code which can display multiline text in the HTMLDrawable. 


@Bayan I will try that. 

Hardik I know what i will say might sound silly, but try it. Hopes it solves it for you as it did for me. Put a white paper on your camera and move your phone around. If i am right this could be just a positioning problem Best of luck
Hi Hardik,

I am a bit confused here since the code you have posted does not include a multiline text. Do you mean that you do not see any text at all? Please clarify.

Thanks
Eva

 

Is there any sample for the using multiline text in the HTML Drawables? 

 I have done code like this from the documentation but it is not displayed in the view. How can I display multiline text in the HtmlDrawable?

    this.htmlDrawable = new AR.HtmlDrawable({html:"<div>My div</div>"}, 30, {
                                            offsetX : 1,
                                           horizontalAnchor : AR.CONST.HORIZONTAL_ANCHOR.LEFT,
                                           opacity : 0.9
                                           });

 

I am doing this code in the Wikitude sample 'marker.js'. 


Hello Bayan,

I believe that HTML Drawables would be the only option here.

Thanks
Eva

 

Still there is no direct way to have multiple lines?


Thanks so much for the reply.

That is what I thought the answer would be.  Now to move on to implementation.

Steve Saxton
Currently this is not directly possible. A Label is by our definition a single line of text. We are working on solutions for the next version to have formatted multi line text.
Right now I would suggest to split it manually the text into 2 lines, create 2 AR.Labels and use the offsetY property to position one label on top of the other.
Does anyone look at these entries?  I would REALLY appreciate an answer on this question.  I know that I could do it by creating html boxes myself and populating them with the right information, but it would make my life a lot easier if I could just find out whether it is possible to have a multi-line label and how.

Steve Saxton
So far after playing with your SDK, that is the only thing that I can?t accomplish that I require in order to become a paying customer.

Below are the two ways I have tried and it still always shows up on just one line.
var label = new AR.Label(jsonObject.id + ": " + " : " + jsonObject.name,1.0,
{offsetY : 21.0,
triggers: {
onClick:
createClickTrigger(jsonObject.id)},
style : {textColor : '#FFC100',backgroundColor : '#FFFFFF80'}});

var label = new AR.Label(jsonObject.id + ": " + " : /n" + jsonObject.name,1.0,
{offsetY : 21.0,
triggers: {
onClick:
createClickTrigger(jsonObject.id)},
style : {textColor : '#FFC100',backgroundColor : '#FFFFFF80'}});
Login or Signup to post a comment