diff --git a/css/components/_pretext.scss b/css/components/_pretext.scss
index 45b9b4274a..7ef08d698c 100644
--- a/css/components/_pretext.scss
+++ b/css/components/_pretext.scss
@@ -28,6 +28,7 @@ $navbar-breakpoint: 800px !default;
@use 'google-search';
@use 'pretext-search';
@use 'interactives/runestone';
+@use 'interactives/other';
@use 'interactives/webwork';
@use 'interactives/sagecell';
diff --git a/css/components/interactives/_other.scss b/css/components/interactives/_other.scss
new file mode 100644
index 0000000000..a21373545d
--- /dev/null
+++ b/css/components/interactives/_other.scss
@@ -0,0 +1,34 @@
+.interactive-iframe-container {
+ max-width: 100%;
+ overflow: auto;
+ & > iframe {
+ margin-left: auto;
+ margin-right: auto;
+ display: block;
+ }
+}
+
+.interactive-iframe-container__opener {
+ display: block;
+ margin-right: 5px;
+ margin-top: 11px;
+ margin-bottom: 5px;
+ font-size: 0.8rem;
+ & .icon {
+ font-size: 18px;
+ }
+
+ // if figcaption or instructions follow, this should float next to that
+ &:has(+ figcaption, + .instructions) {
+ float: left;
+ z-index: 1; // place above fig caption in render stack
+ position: relative; // for z-index
+ }
+
+ // and if both, the figcaption should clear
+ + .instructions + figcaption {
+ clear: left;
+ }
+
+ + .instructions { margin-top: .5em; }
+}
diff --git a/examples/sample-article/media/code/d3/collision.js b/examples/sample-article/media/code/d3/collision.js
index b82593ec81..8e7d38fcd8 100644
--- a/examples/sample-article/media/code/d3/collision.js
+++ b/examples/sample-article/media/code/d3/collision.js
@@ -21,7 +21,8 @@ force.start();
var svg = d3.select("#d3-collision").append("svg")
.attr("width", width)
- .attr("height", height);
+ .attr("height", height)
+ .attr("display", "block");
svg.selectAll("circle")
.data(nodes.slice(1))
diff --git a/examples/sample-article/media/code/d3/graph-layout.js b/examples/sample-article/media/code/d3/graph-layout.js
index 453bf1d8de..b572ea6743 100644
--- a/examples/sample-article/media/code/d3/graph-layout.js
+++ b/examples/sample-article/media/code/d3/graph-layout.js
@@ -14,19 +14,24 @@
main()
function main() {
- var range = 50
+ setSize(data)
+
+ // Add more data when we have a larger canvas
+ var range = Math.pow(width, 1.3) / 50
var data = {
nodes:d3.range(0, range).map(function(d){ return {label: "l"+d ,r:~~d3.randomUniform(4, 16)()}}),
links:d3.range(0, range).map(function(){ return {source:~~d3.randomUniform(range)(), target:~~d3.randomUniform(range)()} })
}
- setSize(data)
drawChart(data)
}
function setSize(data) {
- width = document.querySelector("#d3-graph-layout").clientWidth
- height = document.querySelector("#d3-graph-layout").clientHeight
+ // boundingRect provides true decimal values for dimensions.
+ // clientWidth/clientHeight are integer values that may have been rounded up
+ let boundingRect = document.querySelector("#d3-graph-layout").getBoundingClientRect()
+ width = Math.floor(boundingRect.width)
+ height = Math.floor(boundingRect.height)
margin = {top:0, left:0, bottom:0, right:0 }
@@ -34,7 +39,7 @@
chartWidth = width - (margin.left+margin.right)
chartHeight = height - (margin.top+margin.bottom)
- svg.attr("width", width).attr("height", height)
+ svg.attr("width", width).attr("height", height).attr("display", "block")
chartLayer
diff --git a/examples/sample-article/media/code/mcclure/slope.css b/examples/sample-article/media/code/mcclure/slope.css
index 999ff001d3..f4ff41a81b 100644
--- a/examples/sample-article/media/code/mcclure/slope.css
+++ b/examples/sample-article/media/code/mcclure/slope.css
@@ -36,7 +36,8 @@ h1 {
svg {
background: white;
border: 1px solid darkslategray;
- margin: 20px;
+ margin-top: 20px;
+ margin-bottom: 20px;
}
.function_radio_container {
diff --git a/examples/sample-article/media/code/mcclure/slope.js b/examples/sample-article/media/code/mcclure/slope.js
index d859bfd88d..119ae4d51c 100644
--- a/examples/sample-article/media/code/mcclure/slope.js
+++ b/examples/sample-article/media/code/mcclure/slope.js
@@ -4,7 +4,7 @@
var body_width = 600;
$("body").css("width", body_width);
-var svg_width = 580, svg_height = 400, graph_padding = 20;
+var svg_width = 600, svg_height = 400, graph_padding = 20;
$("#the_graph").css("margin-left", (body_width-svg_width)/2);
var svg = d3.select("#the_graph")
.attr("width", svg_width)
diff --git a/examples/sample-article/media/code/splice/splice-resize.js b/examples/sample-article/media/code/splice/splice-resize.js
new file mode 100644
index 0000000000..1cab4ce578
--- /dev/null
+++ b/examples/sample-article/media/code/splice/splice-resize.js
@@ -0,0 +1,19 @@
+const bodyEl = document.body;
+bodyEl.style.background = 'red';
+
+const growBtn = document.createElement('button');
+growBtn.textContent = 'Grow';
+document.currentScript.parentElement.appendChild(growBtn);
+
+growBtn.addEventListener('click', () => {
+ const currentHeight = bodyEl.clientHeight;
+ const newHeight = currentHeight + 100;
+ bodyEl.style.height = `${newHeight}px`;
+ window.parent.postMessage(
+ {
+ subject: 'lti.frameResize',
+ height: newHeight,
+ },
+ '*'
+ )
+});
\ No newline at end of file
diff --git a/examples/sample-article/media/code/threejs/catenoid.js b/examples/sample-article/media/code/threejs/catenoid.js
index 81680d0c3e..2e22c45b16 100644
--- a/examples/sample-article/media/code/threejs/catenoid.js
+++ b/examples/sample-article/media/code/threejs/catenoid.js
@@ -1,7 +1,7 @@
var scene = new THREE.Scene();
var renderer = new THREE.WebGLRenderer( { antialias: true } );
- renderer.setSize( window.innerWidth, window.innerHeight );
+ renderer.setSize( window.innerWidth, window.innerHeight - 5 );
renderer.setClearColor( 0xfff000, 1 );
// RAB edit 2021-08-10
// document.body.appendChild( renderer.domElement );
diff --git a/examples/sample-article/media/code/threejs/saddle.js b/examples/sample-article/media/code/threejs/saddle.js
index d26f44b2ee..aebd5c41e8 100644
--- a/examples/sample-article/media/code/threejs/saddle.js
+++ b/examples/sample-article/media/code/threejs/saddle.js
@@ -14,6 +14,7 @@
// document.body.appendChild( renderer.domElement );
var renderDiv = document.getElementById("threejs-saddle");
renderDiv.appendChild( renderer.domElement );
+ renderer.domElement.style.display = 'block'; // Prevents scroll bars
var b = [{"x":-1.0, "y":-1.0, "z":-0.9993425378040762}, {"x":1.0, "y":1.0, "z":0.9993425378040762}]; // bounds
diff --git a/examples/sample-article/publication.xml b/examples/sample-article/publication.xml
index 4e2e5afebd..78a040484a 100644
--- a/examples/sample-article/publication.xml
+++ b/examples/sample-article/publication.xml
@@ -144,6 +144,13 @@ along with PreTeXt. If not, see .
+
+
+
+
+
+
+