Skip to content

Commit

Permalink
Gui/Mesh: [skip ci] put view positions at top of Web 3d page
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Sep 7, 2020
1 parent 34c11fc commit 6019f6c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
3 changes: 2 additions & 1 deletion src/Gui/SoFCDB.cpp
Expand Up @@ -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";
Expand All @@ -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();
Expand Down
22 changes: 11 additions & 11 deletions src/Mod/Mesh/App/Core/MeshIO.cpp
Expand Up @@ -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");
Expand All @@ -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;
Expand Down

0 comments on commit 6019f6c

Please sign in to comment.