Gui/Mesh: [skip ci] put view positions at top of Web 3d page

This commit is contained in:
wmayer
2020-09-07 14:18:01 +02:00
parent a51d2bab99
commit 208c2f5e6c
2 changed files with 13 additions and 12 deletions

View File

@@ -643,7 +643,6 @@ bool Gui::SoFCDB::writeToX3DOM(SoNode* node, std::string& buffer)
<< " <script type='text/javascript' src='http://www.x3dom.org/download/x3dom.js'> </script>\n"
<< " <link rel='stylesheet' type='text/css' href='http://www.x3dom.org/download/x3dom.css'></link>\n"
<< " </head>\n";
out << x3d;
auto onclick = [&out](const char* text) {
out << " <button onclick=\"document.getElementById('" << text << "').setAttribute('set_bind','true');\">" << text << "</button>\n";
@@ -656,6 +655,8 @@ bool Gui::SoFCDB::writeToX3DOM(SoNode* node, std::string& buffer)
onclick("Top");
onclick("Bottom");
out << x3d;
out << "</html>\n";
buffer = out.str();

View File

@@ -3199,6 +3199,17 @@ bool MeshOutput::SaveX3DOM (std::ostream &out) const
<< " <link rel='stylesheet' type='text/css' href='http://www.x3dom.org/download/x3dom.css'></link>\n"
<< " </head>\n";
auto onclick = [&out](const char* text) {
out << " <button onclick=\"document.getElementById('" << text << "').setAttribute('set_bind','true');\">" << text << "</button>\n";
};
onclick("Front");
onclick("Back");
onclick("Right");
onclick("Left");
onclick("Top");
onclick("Bottom");
#if 0 // https://stackoverflow.com/questions/32305678/x3dom-how-to-make-zoom-buttons
function zoom (delta) {
var x3d = document.getElementById("right");
@@ -3211,17 +3222,6 @@ bool MeshOutput::SaveX3DOM (std::ostream &out) const
SaveX3DContent(out, true);
auto onclick = [&out](const char* text) {
out << " <button onclick=\"document.getElementById('" << text << "').setAttribute('set_bind','true');\">" << text << "</button>\n";
};
onclick("Front");
onclick("Back");
onclick("Right");
onclick("Left");
onclick("Top");
onclick("Bottom");
out << "</html>\n";
return true;