Attribute name | Type | Default value |
text
html
|
String String |
|
- Set the text/content for the textfield.
- The text can be HTML or BBCode formatted and styled by CSS styles or CSS classes.
- Note - for defining CSS styles/classes directly in the xml file, the <cssstyles> element can be used.
- BBCode encoding:
- In some cases, e.g. inside xml attributes or inside strings, some characters can't be used directly.
Here the BBCode encoding provides alternatives.
- BBCode character mapping:
- < ⇒ [ or [lt]
- > ⇒ ] or [gt]
- ' ⇒ [sq]
- " ⇒ [dq]
- [ ⇒ [[
- ] ⇒ ]]
- The BBCode encoding can be disabled using the rawhtml setting.
- Escaping:
- As alternative to the BBCode-encoding, it is also possible to
escape
the HTML code.
- Load the content from <data> or other elements:
- Linking to krpano actions or to Javascript code:
- There is a special support for using HTML-links with:
- href="krpano:..." or href="event:..."
to call krpano actions, or
- href="js:..." to call Javascript code.
- The default scope for the krpano actions will be the textfield.
- In Javascript code there are predefined krpano and caller (the textfield) objects.
- Actions Example:
[a href="krpano:showlog();trace('hello from ',name);"]link[/a]
- Javascript Example:
[a href="js:console.log(caller.path); krpano.actions.lookto(0,0);"]...
|
Attribute name | Type | Default value |
template | String | |
- Use a 'template' for automatic text generation.
- When the template setting is set,
it will be automatically evaluated and any changes will set the text to the result.
- Syntax:
template="... {{variable}} ..."
With multiple variables and expressions:
template="... {{variable1|variable2:expression}} ..."
With events and expressions:
template="... {{event.NAME:expression}} ..."
With the translate() expression:
template="... {{translate(word)}} ..."
- Everything between {{ and }} will be evaluated.
- There can be either a simple link to a variable - then every time when this variables changes,
the text will be automatically regenerated.
- Or a more complex expression can be used.
In this case, first the variables that should be monitored for changes need to be defined
(separated by | or , characters),
and second, the expression itself after a : character.
When any of the variables change, the expression will be automatically reevaluated the
the text be updated.
- For manual updates the updatetemplate() function can be used.
|
Attribute name | Type | Default value |
rawhtml | Boolean | false |
- When enabled the content of the text setting will be used directly as HTML code for the textfield content.
No parsing or modifications will be applied. No BBCode encoding, no escaping.
No default font, font-size, text-color.
- These settings will also have no effect when enabled: padding, txtshadow.
|
Attribute name | Type | Default value |
css | String | "" |
|
Attribute name | Type | Default value |
txtshadow |
String |
"" |
|
Attribute name | Type | Default value |
textalign | String | "lefttop" |
- Alignment of the text/content within the textfield.
- Possible values: lefttop, left, leftbottom, top, center, bottom, righttop, right, rightbottom.
|
Attribute name | Type | Default value |
padding | String | "2" |
- Padding / space in pixels around the text/content. Can be individually for each side.
- There are 4 different ways to set the paddings (same as in CSS):
- padding="25"
- all four paddings are 25px
- padding="25 50"
- top and bottom paddings are 25px
- right and left paddings are 50px
- padding="25 50 75"
- top padding is 25px
- right and left paddings are 50px
- bottom padding is 75px
- padding="25 50 75 100"
- top padding is 25px
- right padding is 50px
- bottom padding is 75px
- left padding is 100px
|
Attribute name | Type | Default value |
trimwhitespace | Boolean | false |
- Trim leading and trailing whitespace from all lines.
- This could be used when using 'monospace / white-space=pre ' formatted texts and
to skip the xml-caused space/tab-indentations.
|
Attribute name | Type | Default value |
wordwrap | Boolean | true |
- Set if the text should automatically wrap around (line-break) to new lines when the text doesn't fit into the current line.
- This setting has only an effect when setting a width for the textfield.
- When disabled the text would get cut-off when it is larger than the given textfield width.
|
Attribute name | Type | Default value |
ellipsis | Boolean | false |
- When the text/content is larger than the given textfield width and line-breaking is not allowed or possible,
then the text will end with three dots '...' instead of a hard-cut.
|
Attribute name | Type | Default value |
interactive | Boolean | false * |
- When enabled a direct mouse/touch interaction with the textfield content is possible.
- By default this is disabled to avoid conflicts when krpano and a HTML inner content are both processing the mouse or touch events.
- Note - when the HTML content contains <a> or <iframe> elements, then this setting will be automatically enabled!
|
Attribute name | Type | Default value |
selectable | Boolean | false |
- Should the text/content be selectable by the user.
- When enabled the browsers native/default contextmenu will appear when right-clicking (or long-touching) on the textfield.
- Note - the selectable setting overrides the nativecontextmenu setting!
|
Attribute name | Type | Default value |
editable | Boolean | false |
- Should the text/content be editable by the user.
- When enabled the user can click into the textfield and edit it.
- To get informed about editing changes there are these events:
- The edited content will be stored in the text variable.
- Note that the edited content can be slightly different in each browser.
- For dynamically starting or stopping editing these actions can be called:
|
Attribute name | Type | Default value |
editenterkey | String | "stop" |
- Define what should happen when the user presses the Enter-key during editing:
- stop - Stop/finish the editing (default).
- newline - create a line-break / new-line.
- shiftnewline - create a line-break / new-line when only pressing the Shift+Enter keys, otherwise stop the editing.
|
Attribute name (only for WebGL-Hotspots usage) | Type | Default value |
oversampling |
Number |
1.0 |
- Upscale the internal bitmap rendering target by the given oversampling factor for a higher-resolution (sharper) text.
- Settings larger 1.0 are improving the text-rendering-quality, but also requiring more memory- and rendering-resources.
- Only related for WebGL hotspot rendering.
|
Attribute name (only for WebGL-Hotspots usage) | Type | Default value |
mipmapping |
Boolean |
false |
- Enable mipmapping - this reduces aliasing effects when displaying the text as scaled-down element.
- Mipmapping works by automatically upscaling the internal bitmap rendering target to the next power-of-two size (because that is required for mipmapping).
- For better image/text-quality it would be recommended to use additionally also a higher than 1.0 oversampling setting.
- Only related for WebGL hotspot rendering.
|