简体   繁体   English

Xtk中的渲染器大小

[英]Renderer size in xtk

Playing with xtk (http://www.goxtk.org). 使用xtk(http://www.goxtk.org)。 How do you impose a size to the renderer? 如何为渲染器设置尺寸? I'm asking because upon calling init on the renderer, the container div grows. 我问是因为在渲染器上调用init时,容器div增大了。 I'm not using width or high 100% as in the examples, I'm using an absolute size. 我没有在示例中使用宽度或高100%,而是在使用绝对尺寸。 Thanks for any hint. 感谢您的任何提示。

It should work to specify the renderer size in pixel by adjusting the -tag which is the container for the X.renderer. 通过调整-tag(它是X.renderer的容器),可以指定渲染器大小(以像素为单位)。

For example, this is from XTK Lesson 7 where three X.renderers are used with an absolute size (see http://lessons.goxtk.com/07/ ): 例如,这来自XTK第7课,其中使用了三个具有绝对大小的X.renderer(请参阅http://lessons.goxtk.com/07/ ):

...
<div id='r1' style='background-color:#000000; float: left; width: 300px; height: 300px; margin:10px;'></div>
<div id='r2' style='background-color:#000000; float: left; width: 300px; height: 300px; margin:10px;'></div>
<div id='r3' style='background-color:#000000; float: left; width: 300px; height: 300px; margin:10px;'></div>
...

Nevertheless, for the automatic progressbar to be displayed properly, the position style is changed to relative . 但是,为了正确显示自动进度条,位置样式更改为relative This might cause the container to adjust depending on how your general page layout looks. 这可能会导致容器根据您的总体页面布局外观进行调整。

If you rather want the absolute position style and don't need the progressbar, you can disable it like this which also prevents changing the position style of the container: 如果您希望使用绝对位置样式而不需要进度条,则可以像这样禁用它,这也可以防止更改容器的位置样式:

...
r1 = new X.renderer('r1');
r1.config.PROGRESSBAR_ENABLED = false;
r1.init();
...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM