diff --git a/README.md b/README.md index 78a5003..a43e66e 100644 --- a/README.md +++ b/README.md @@ -358,6 +358,7 @@ Axis tickScale: 10, // Integer denoting the base for recursive division. 2 = binary, 10 = decimal arrow: true, // Whether to include an arrow on the axis size: .07, // Size of the arrow relative to the stage + formatter: null // Function which takes index of axis label as argument, and returns text label }) ``` @@ -422,6 +423,17 @@ Grid }) ``` +Label +```javascript +.label({ + position: [0, 0, 0], // location of label + text: 'hello', // text to be displayed + distance: 15, // text sprite anchor point offset + facing: 1, // which axis tangent direction the label should be facing towards + class_name: 'math' // css class name to use for the labels (leave unset for default 'mathbox-labels') +}) +``` + Surface ```javascript .surface({ @@ -455,6 +467,13 @@ Vector }) ``` +Dependencies +------------ + +* vendor/ThreeBox.js -- https://github.com/unconed/ThreeBox.js (use commit tag ff838075a7bea4ba59719f845f466b9c4b2cbafe) +* vendor/ThreeRTT.js -- https://github.com/unconed/ThreeRTT.js +* vendor/ShaderGraph.js -- https://github.com/unconed/ShaderGraph.js + Contributions ------------- diff --git a/build.sh b/build.sh index a5657c7..eb4e208 100755 --- a/build.sh +++ b/build.sh @@ -36,6 +36,7 @@ src/primitives/Vector.js src/primitives/Surface.js src/primitives/BezierSurface.js src/primitives/Platonic.js +src/primitives/Label.js src/renderables/Renderable.js src/renderables/Mesh.js diff --git a/build/MathBox-bundle.js b/build/MathBox-bundle.js index d9695f6..b837808 100644 --- a/build/MathBox-bundle.js +++ b/build/MathBox-bundle.js @@ -40197,26 +40197,14 @@ ThreeBox.preload.html = function (file, name, callback) { var match; // Insert javascript directly - while (match = res.match(/^(|]*type=['"]text\/javascript['"][^>]*>)([\s\S]+?)<\/script>$/m)) { - try { - /* - var script = document.createElement('script'); - script.type = 'text/javascript'; - script.innerHTML = match[2]; - document.body.appendChild(script); - */ - eval('(function () {' + match[2] + '})()'); - } - catch (e) { - console.error(e); - console.error('While evaluating: ' + match[2]); - } - - res = res.replace(match[0], ''); + if (match = res.match(/^]*type=['"]text\/javascript['"][^>]*>([\s\S]+?)<\/script>$/m)) { + var script = document.createElement('script'); + script.type = 'text/javascript'; + script.innerHTML = match[1]; + document.body.appendChild(script); } - // Insert HTML via div - if (res.replace(/\s*/g) != '') { + else { var div = document.createElement('div'); div.innerHTML = res; document.body.appendChild(div); @@ -40264,12 +40252,13 @@ ThreeBox.preload.audio = function (file, name, callback) { // Namespace window.ThreeRTT = window.ThreeRTT || {}; +ThreeRTT.World = function () {}; // Fetch shader from + + \ No newline at end of file diff --git a/build/MathBox.js b/build/MathBox.js index 97efc30..b5c1f7d 100644 --- a/build/MathBox.js +++ b/build/MathBox.js @@ -569,26 +569,14 @@ ThreeBox.preload.html = function (file, name, callback) { var match; // Insert javascript directly - while (match = res.match(/^(|]*type=['"]text\/javascript['"][^>]*>)([\s\S]+?)<\/script>$/m)) { - try { - /* - var script = document.createElement('script'); - script.type = 'text/javascript'; - script.innerHTML = match[2]; - document.body.appendChild(script); - */ - eval('(function () {' + match[2] + '})()'); - } - catch (e) { - console.error(e); - console.error('While evaluating: ' + match[2]); - } - - res = res.replace(match[0], ''); + if (match = res.match(/^]*type=['"]text\/javascript['"][^>]*>([\s\S]+?)<\/script>$/m)) { + var script = document.createElement('script'); + script.type = 'text/javascript'; + script.innerHTML = match[1]; + document.body.appendChild(script); } - // Insert HTML via div - if (res.replace(/\s*/g) != '') { + else { var div = document.createElement('div'); div.innerHTML = res; document.body.appendChild(div); @@ -636,12 +624,13 @@ ThreeBox.preload.audio = function (file, name, callback) { // Namespace window.ThreeRTT = window.ThreeRTT || {}; +ThreeRTT.World = function () {}; // Fetch shader from