mirror of
https://bitbucket.org/wisemapping/wisemapping-frontend.git
synced 2024-11-25 23:54:55 +01:00
cb2ca74a20
Core-js, web2d and mindplot working baseline * fix .eslintignore remove Raphael dependency * Fix to avoid crashes in _plotPrediction whitout Raphael * Fix minplot basic code inspections * Fix last inspections errors * Inital refactor copying files * Clean up. * Fix web2d cyclic dependencies remove only-warn eslint plugin set import/no-extraneous-dependencies to warn (incorrectly complaining about root package) * Fix web2d Point references (no need to assign it to core) Fix web2d imports in mindplot and update Point refs * Merge 'feature/mindplot_tests' into web2d-coreJS-solutions * mindplot fixes and add viewmode.html playground setup playground config to run the map-render examples fix mindplot components export mootools Static was not working so refactored it fix some references to _peer fix messages __bundle undefined add web2d missing export: Image downgrade cypress to avoid SIGSEGV error Approved-by: Paulo Veiga
114 lines
4.0 KiB
HTML
Executable File
114 lines
4.0 KiB
HTML
Executable File
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
|
|
<head>
|
|
<style>
|
|
th,
|
|
td {
|
|
border: 1px solid black;
|
|
}
|
|
</style>
|
|
|
|
<script type="text/javascript">
|
|
web2d = {
|
|
peer: {}
|
|
};
|
|
|
|
web2d.peer =
|
|
{
|
|
svg: {}
|
|
};
|
|
|
|
web2d.peer.utils = {};
|
|
</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);
|
|
}
|
|
}
|
|
|
|
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 text = new web2d.Text();
|
|
overflowWorkspace.append(text);
|
|
var scale = web2d.TransformUtils.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(document.getElementById(owner));
|
|
|
|
var parent = document.getElementById(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.append(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.append(span);
|
|
workspaces[iesimo] = overflowWorkspace;
|
|
};
|
|
|
|
function initialize() {
|
|
web2d.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);
|
|
TextTest("100px", 100, "Test Text\nMultiline", "Arial", 10, "italic", "bold", "green", "text5", 5);
|
|
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
|
|
<body onload="initialize();">
|
|
|
|
<h1>Text Render Tests </h1>
|
|
|
|
<table>
|
|
<colgroup style="width:80%;">
|
|
<col style="width:30%" />
|
|
<col style="width:60%" />
|
|
</colgroup>
|
|
<tr>
|
|
<td>
|
|
Simple text
|
|
</td>
|
|
<td>
|
|
<div id="text0"></div>
|
|
<div id="text1"></div>
|
|
<div id="text2"></div>
|
|
<div id="text3"></div>
|
|
<div id="text4"></div>
|
|
<div id="text5"></div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
<!--**************************************************************************-->
|
|
|
|
</table>
|
|
<span>Text to Inspect: </span><input type="text" id="iesimo">
|
|
<input type="button" value="Inspect"
|
|
onclick="alert(document.getElementById('textoHTML'+document.id('iesimo').value).offsetWidth);">
|
|
<input type="button" value="Zoom In" onclick="zoomIn()">
|
|
</body>
|
|
|
|
</html>
|