如何使缩放器更新XUL中的项目位置?

时间:2011-04-14 09:16:49

标签: resize xul

我有以下代码,其中一个按钮有四个缩放器。例如,当我使用左上角缩放器时,它按钮从右下方缩小,而不是缩小和移动,以便左上角跟随光标。我查看了Mozilla的文档和谷歌,并尝试在mousedown事件处理程序上添加自定义来移动事物 - 但无济于事。如何使这种行为正确?

<?xml version="1.0"?>

<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<window id="main" title="My App" width="300" height="300" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <script type="application/javascript" src="chrome://ades/content/main.js"/>
    <hbox>
      <stack style="padding: 0;">
        <button id="b" label="Resizable" style="margin: 0;"/>
        <resizer dir="topleft" style="background: red; -moz-appearance: none;"
                 element="b" left="0" top="0" width="5" height="5" />
        <resizer dir="topright" style="background: black; -moz-appearance: none;"
                 element="b" right="0" top="0" width="5" height="5"/>
        <resizer dir="bottomleft" style="background: black; -moz-appearance: none;"
                 element="b" left="0" bottom="0" width="5" height="5"/>
        <resizer dir="bottomright" style="background: black; -moz-appearance: none;"
                 element="b" right="0" bottom="0" width="5" height="5"/>
      </stack>
    </hbox>
</window>

1 个答案:

答案 0 :(得分:0)

我不确定如何实现你想要的东西,但是如果你正在调整你的按钮大小,它总会在堆栈中重新定位(在hbox的开头),所以它总是在hbox。您可以尝试绝对定位,但我不确定这是否也可以。