1

Windows 7でサイドバーガジェットを作成し、ag:textObjectを追加し、後でvariable.valueを使用して値を変更しました。

しかし、Windows Vistaで実行すると、テキストが奇妙に圧縮されているように見えます。

このコードに何か問題がありますか?

var clock = document.getElementById("background").addTextObject("Time", "Nyala", 18, "white", 110, 500);
//This correctly displays the word 'Time' in the proper font.

clock.value = clock.value+"s";
//This causes the text to become "Times" but shrink.
//appending more sporadically causes the textObject to shrink as well.

.valueを使用するのは間違った方法ですか?

4

1 に答える 1

1

テキスト文字列を変更しても、g:textオブジェクトの幅や高さは更新されません。これは既知の問題であり、互換性のために修正されない可能性があります。値を変更して、幅と高さを手動でリセットする必要があります。

var clock = document.getElementById("background")
    .addTextObject("Time", "Nyala", 18, "white", 110, 500);

// Set the new value and reset the width and height by setting them to 0
clock.value  = clock.value+"s";  
clock.width  = 0;
clock.height = 0;
于 2010-01-19T14:21:23.707 に答える