Skip to content

Commit 5d729dd

Browse files
committed
test commit for 3d manual
1 parent 1bf8b59 commit 5d729dd

File tree

8 files changed

+835
-0
lines changed

8 files changed

+835
-0
lines changed

manual/51-CAD.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<style>
6+
iframe {
7+
border: none;
8+
display: flex;
9+
justify-content: center;
10+
align-items: center;
11+
height: 100vh;
12+
margin: 0;
13+
}
14+
</style>
15+
</head>
16+
<body>
17+
<iframe id="targetFrame" src="./FrameManualTest v2-sfa.html" width="100%" ></iframe>
18+
</body>
19+
20+
</html>

manual/51-test.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,13 @@ Text goes hereText goes hereText goes hereText goes hereText goes hereText goes
4545
</div>
4646
</div>
4747

48+
### SAMPLE SUBSECTION 4
49+
<div class="content-wrapper fullPage">
50+
<div class="image-container fullPage">
51+
<img src="images/Vectors/test_view.svg" onload="SVGInject(this)" color="accent" id="svgAccent" />
52+
<div class="text-bubble bubble-green">Z Drive</div>
53+
</div>
54+
</div>
55+
4856

4957

manual/FrameManualTest v2-sfa.html

Lines changed: 470 additions & 0 deletions
Large diffs are not rendered by default.

manual/images/PNGs/Z_drive.png

178 KB
Loading

manual/images/Vectors/assembly/bed_mount.svg

Lines changed: 158 additions & 0 deletions
Loading

manual/images/Vectors/test_view.svg

Lines changed: 25 additions & 0 deletions
Loading

manual/tool/template/svg-color.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ document.addEventListener("DOMContentLoaded", function () {
2222
const newColor = input.value;
2323
button.querySelector("i").style.color = newColor;
2424
document.documentElement.style.setProperty('--accent', newColor);
25+
2526
// Only target paths for the current picker (main or accent)
2627
// document.querySelectorAll('svg[color]').forEach(svg => {
2728
// const svgColor = svg.getAttribute('color');

manual/tool/template/svg-inject.js

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,159 @@
292292
}
293293

294294

295+
function ShowHotSpot(evt,hotspotid)
296+
{
297+
var svgDocument = evt.target.ownerDocument;
298+
var strId = "hotspot."+hotspotid;
299+
var hotspot = svgDocument.getElementById(strId);
300+
if(hotspot)
301+
hotspot.setAttribute("opacity",".5");
302+
}
303+
function HideHotSpot(evt,hotspotid)
304+
{
305+
var svgDocument = evt.target.ownerDocument;
306+
var strId = "hotspot."+hotspotid;
307+
var hotspot = svgDocument.getElementById(strId);
308+
if(hotspot)
309+
hotspot.setAttribute("opacity","0");
310+
311+
var toolTip = svgDocument.getElementById('ToolTip');
312+
if(toolTip)
313+
toolTip.setAttribute("visibility","hidden");
314+
}
315+
function ShowToolTip(evt,hotspotid,strTooltip)
316+
{
317+
if(strTooltip=="")
318+
return;
319+
320+
// change text
321+
var svgDocument = evt.target.ownerDocument;
322+
var tiptext = svgDocument.getElementById('ToolTipText');
323+
if( !tiptext )
324+
return;
325+
tiptext.firstChild.nodeValue = " " + strTooltip + " " ;
326+
327+
// show tooltip before, else some refresh issue
328+
329+
var toolTip = svgDocument.getElementById('ToolTip');
330+
if(!toolTip)
331+
return;
332+
333+
toolTip.setAttribute("visibility","visible");
334+
toolTip.setAttribute("opacity",".95");
335+
336+
// move tooltip
337+
// get viewbox
338+
339+
var root = svgDocument.documentElement;
340+
var vbox = (root.getAttribute("viewBox")).split(' ');
341+
var x0 = parseFloat(vbox[0]);
342+
var y0 = parseFloat(vbox[1]);
343+
var vboxW = parseFloat(vbox[2]);
344+
var vboxH = parseFloat(vbox[3]);
345+
346+
// get default width of svg
347+
348+
var strW = root.getAttribute("width");
349+
var svgW = parseFloat(strW);
350+
if(strW.indexOf('mm') != -1)
351+
svgW *= 3.779;
352+
353+
var strH = root.getAttribute("height");
354+
var svgH = parseFloat(strH);
355+
if(strH.indexOf('mm') != -1)
356+
svgH *= 3.779; // 96 dpi -> 96/25.4 = 3.779
357+
358+
// update the viewbox / width / height if svg is embedded in html with zoom fit all
359+
var realx0 = x0;
360+
var realy0 = y0;
361+
var realvboxW = vboxW;
362+
var realvboxH = vboxH;
363+
var realsvgW = svgW;
364+
var realsvgH = svgH;
365+
366+
if ((typeof(top) == "undefined") || (typeof(top.svgctl1) != "undefined")) // embedded in html
367+
{
368+
// get window size in pxl
369+
370+
svgW = window.innerWidth;
371+
svgH = window.innerHeight;
372+
373+
// calculate real viewbox
374+
375+
realsvgW = svgW;
376+
realsvgH = svgH;
377+
if((svgW / svgH) > (vboxW / vboxH))
378+
{
379+
realvboxW = (vboxH * svgW) / svgH;
380+
realvboxH = vboxH;
381+
realx0 = x0 - (realvboxW - vboxW)/2 ;
382+
}
383+
else
384+
{
385+
realvboxH = (vboxW * svgH) / svgW;
386+
realvboxW = vboxW;
387+
realy0 = y0 - (realvboxH - vboxH)/2 ;
388+
}
389+
}
390+
391+
// get user zoom/pan
392+
393+
var newScale = root.currentScale;
394+
var translation = root.currentTranslate;
395+
396+
// transform pxl to user unit
397+
398+
var xPos = (((evt.clientX+10- translation.x)/newScale) * realvboxW)/realsvgW + realx0 ;
399+
var yPos = (((evt.clientY+5- translation.y)/newScale) * realvboxH)/ realsvgH + realy0 ;
400+
var scaleForWidth = ( (1 / newScale) * realvboxH) / realsvgH;
401+
402+
// move tooltip
403+
404+
toolTip.setAttribute("transform", "translate(" + xPos + "," + yPos + ")" );
405+
406+
// resize tooltip
407+
408+
var fontsize = 12;
409+
tiptext.setAttribute("font-size",fontsize*scaleForWidth);
410+
tiptext.setAttribute("y", fontsize*scaleForWidth);
411+
var tipBG = svgDocument.getElementById('ToolTipBG');
412+
var outline = tiptext.getBBox();
413+
if(tipBG)
414+
{
415+
tipBG.setAttribute("stroke-width", 1*scaleForWidth);
416+
tipBG.setAttribute("width", Number(outline.width) );
417+
tipBG.setAttribute("height", Number(outline.height) + fontsize*.5*scaleForWidth );
418+
}
419+
var ToolTipShadow = svgDocument.getElementById('ToolTipShadow');
420+
if(ToolTipShadow)
421+
{
422+
ToolTipShadow.setAttribute("width", Number(outline.width) );
423+
ToolTipShadow.setAttribute("height", Number(outline.height) + fontsize*.5*scaleForWidth );
424+
ToolTipShadow.setAttribute("x", 3*scaleForWidth);
425+
ToolTipShadow.setAttribute("y", 3*scaleForWidth);
426+
}
427+
}
428+
function ShowPaper()
429+
{
430+
var svgDocument = getDocument();
431+
var paper = svgDocument.getElementById("paperID");
432+
if(paper)
433+
{
434+
paper.setAttribute("transform","scale(1)");
435+
paper.setAttribute("opacity","1");
436+
paper.setAttribute("visibility","visible");
437+
}
438+
var svg = svgDocument.getRootElement();
439+
if(svg)
440+
{
441+
svg.setAttribute("width","1510.000mm");
442+
svg.setAttribute("height","1010.000mm");
443+
svg.setAttribute("viewBox","-5.000000 -5.000000 1510.000000 1010.000000");
444+
}
445+
}
446+
447+
295448
// Merges any number of options objects into a new object
296449
function mergeOptions() {
297450
var mergedOptions = {};

0 commit comments

Comments
 (0)