Partially supported multilines.
This commit is contained in:
@@ -15,7 +15,8 @@
|
||||
web2d.peer.utils = {};
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools-yui-compressed.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="https://ajax.googleapis.com/ajax/libs/mootools/1.3.2/mootools-yui-compressed.js"></script>
|
||||
<script type="text/javascript" src="../../../../../core-js/target/classes/core.js"></script>
|
||||
<script type="text/javascript" src="../../../../src/main/javascript/peer/svg/ElementPeer.js"></script>
|
||||
<script type="text/javascript" src="../../../../src/main/javascript/Element.js"></script>
|
||||
@@ -44,66 +45,57 @@
|
||||
<script type="text/javascript" src="../../../../src/main/javascript/peer/svg/VerdanaFont.js"></script>
|
||||
<script type="text/javascript" src="utils.js"></script>
|
||||
<script type="text/javascript">
|
||||
function zoomIn()
|
||||
{
|
||||
for(i=0; i<workspaces.length; i++)
|
||||
{
|
||||
var coordSize = workspaces[i].getCoordSize();
|
||||
workspaces[i].setCoordSize(coordSize.width*2,coordSize.height*2);
|
||||
}
|
||||
};
|
||||
function zoomIn() {
|
||||
for (i = 0; i < workspaces.length; i++) {
|
||||
var coordSize = workspaces[i].getCoordSize();
|
||||
workspaces[i].setCoordSize(coordSize.width * 2, coordSize.height * 2);
|
||||
}
|
||||
};
|
||||
|
||||
workspaces = [];
|
||||
var textot;
|
||||
workspaces = [];
|
||||
|
||||
var TextTest = function (size,coordSize,textval,font,fontSizeval, style, modifier, fontColor, owner, iesimo)
|
||||
{
|
||||
var overflowWorkspace = new web2d.Workspace();
|
||||
overflowWorkspace.setSize(size, size);
|
||||
overflowWorkspace.setCoordSize(coordSize,coordSize);
|
||||
overflowWorkspace.setCoordOrigin(0,0);
|
||||
var TextTest = function (size, coordSize, textval, font, fontSizeval, style, modifier, fontColor, owner, iesimo) {
|
||||
var overflowWorkspace = new web2d.Workspace();
|
||||
overflowWorkspace.setSize(size, size);
|
||||
overflowWorkspace.setCoordSize(coordSize, coordSize);
|
||||
overflowWorkspace.setCoordOrigin(0, 0);
|
||||
|
||||
/*var rect = new web2d.Rect(1 / 10);
|
||||
rect.setPosition(40, 40);
|
||||
rect.setSize(20, 20);
|
||||
overflowWorkspace.appendChild(rect);
|
||||
*/
|
||||
var text = new web2d.Text();
|
||||
overflowWorkspace.appendChild(text);
|
||||
var scale = web2d.peer.utils.TransformUtil.workoutScale(text._peer);
|
||||
text.setText(textval+" "+scale.height);
|
||||
text.setFont(font, fontSizeval, style, modifier);
|
||||
text.setPosition(0, 0);
|
||||
text.setColor(fontColor);
|
||||
var text = new web2d.Text();
|
||||
overflowWorkspace.appendChild(text);
|
||||
var scale = web2d.peer.utils.TransformUtil.workoutScale(text._peer);
|
||||
text.setText(textval + " " + scale.height);
|
||||
text.setFont(font, fontSizeval, style, modifier);
|
||||
text.setPosition(0, 0);
|
||||
text.setColor(fontColor);
|
||||
textot = text;
|
||||
|
||||
|
||||
overflowWorkspace.addItAsChildTo($(owner));
|
||||
overflowWorkspace.addItAsChildTo($(owner));
|
||||
|
||||
var parent = $(owner);
|
||||
var span= document.createElement("span");
|
||||
span.setAttribute("id","textoHTML"+iesimo);
|
||||
var textsize = text.offsetWidth;
|
||||
var textHtml=document.createTextNode(textsize);
|
||||
var fontSize=text.getHtmlFontSize();
|
||||
span.appendChild(textHtml);
|
||||
//var fontSize=20*scale.height*2;
|
||||
span.setAttribute("style", "font-weight:"+modifier+";font-style: "+style+"; font-size:"+ fontSize +"pt; font-family: "+font+";width:30;height:30;");
|
||||
var parent = $(owner);
|
||||
var span = document.createElement("span");
|
||||
span.setAttribute("id", "textoHTML" + iesimo);
|
||||
var textsize = text.offsetWidth;
|
||||
var textHtml = document.createTextNode(textsize);
|
||||
var fontSize = text.getHtmlFontSize();
|
||||
span.appendChild(textHtml);
|
||||
//var fontSize=20*scale.height*2;
|
||||
span.setAttribute("style", "font-weight:" + modifier + ";font-style: " + style + "; font-size:" + fontSize + "pt; font-family: " + font + ";width:30;height:30;");
|
||||
|
||||
parent.appendChild(span);
|
||||
workspaces[iesimo]=overflowWorkspace;
|
||||
};
|
||||
parent.appendChild(span);
|
||||
workspaces[iesimo] = overflowWorkspace;
|
||||
};
|
||||
|
||||
function initialize(){
|
||||
web2d.peer.Toolkit.init();
|
||||
TextTest("100px",200,"Test Text","Arial",10, "normal", "normal", "red", "text0", 0);
|
||||
TextTest("100px",100,"Test Text","Arial",10, "normal", "normal", "blue", "text1", 1);
|
||||
TextTest("100px",50,"Test Text","Arial",10, "normal", "normal", "blue", "text2", 2);
|
||||
TextTest("100px",100,"Test Text","Arial",10, "italic", "normal", "blue", "text3", 3);
|
||||
TextTest("100px",100,"Test Text","Arial",10, "italic", "bold", "green", "text4", 4);
|
||||
}
|
||||
function initialize() {
|
||||
web2d.peer.Toolkit.init();
|
||||
TextTest("100px", 200, "Test Text", "Arial", 10, "normal", "normal", "red", "text0", 0);
|
||||
TextTest("100px", 100, "Test Text", "Arial", 10, "normal", "normal", "blue", "text1", 1);
|
||||
TextTest("100px", 50, "Test Text", "Arial", 10, "normal", "normal", "blue", "text2", 2);
|
||||
TextTest("100px", 100, "Test Text", "Arial", 10, "italic", "normal", "blue", "text3", 3);
|
||||
TextTest("100px", 100, "Test Text", "Arial", 10, "italic", "bold", "green", "text4", 4);
|
||||
}
|
||||
|
||||
</script>
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onload="initialize();">
|
||||
@@ -132,7 +124,8 @@
|
||||
|
||||
</table>
|
||||
<span>Text to Inspect: </span><input type="text" id="iesimo">
|
||||
<input type="button" value="Inspect" onclick="alert(document.getElementById('textoHTML'+$('iesimo').value).offsetWidth);">
|
||||
<input type="button" value="Inspect"
|
||||
onclick="alert(document.getElementById('textoHTML'+$('iesimo').value).offsetWidth);">
|
||||
<input type="button" value="Zoom In" onclick="zoomIn()">
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user