Skip to content

Commit

Permalink
Merge pull request #1 from trinketapp/v2.9.0
Browse files Browse the repository at this point in the history
Prep for including v2.9 into trinket.
  • Loading branch information
brianpmarks authored Sep 2, 2019
2 parents 4bbc34d + 98183bf commit a4cc0f2
Show file tree
Hide file tree
Showing 12 changed files with 3,107 additions and 61 deletions.
47 changes: 25 additions & 22 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
var gulp = require('gulp')
, uglify = require('gulp-uglify')
, uglify = require('gulp-uglify-es').default
, concat = require('gulp-concat-util')
, wrap = require('gulp-wrap')
, tap = require('gulp-tap')
, header = require('gulp-header')
, util = require('gulp-util')
, path = require('path')
, version
, glowscript_libraries;

version = '1.1';
version = '2.9.0';

glowscript_libraries = {
"glow": [
"lib/jquery/jquery.mousewheel.js",
"lib/flot/jquery.flot.min.js",
"lib/jquery/2.1/jquery.mousewheel.js",
"lib/flot/jquery.flot.js",
"lib/flot/jquery.flot.crosshair_GS.js",
"lib/flot/jquery.flot.axislabels.js",
"lib/plotly.js",
"lib/opentype/poly2tri.js",
"lib/opentype/opentype.js",
"lib/glMatrix.js",
"lib/webgl-utils.js",
"lib/glow/property.js",
Expand All @@ -27,26 +30,26 @@ glowscript_libraries = {
"lib/glow/WebGLRenderer.js",
"lib/glow/graph.js",
"lib/glow/color.js",
"lib/glow/shapespaths.js",
"lib/glow/primitives.js",
"lib/glow/api_misc.js",
"lib/glow/extrude.js",
"lib/glow/shaders.gen.js"
],
"compiler": [
"../lib/compiler.js",
"../lib/papercomp.js",
"../lib/transform-all.js",
"../lib/coffee-script.js"],
RSrun: [
"../lib/rapydscript/stdlib.js"],
RScompile: [
"../lib/compiler.js",
"../lib/papercomp.js",
"../lib/transform-all.js",
"../lib/rapydscript/baselib.js",
"../lib/rapydscript/utils.js",
"../lib/rapydscript/ast.js",
"../lib/rapydscript/output.js",
"../lib/rapydscript/parse.js"],
"lib/compiling/GScompiler.js",
"lib/compiling/acorn.es.js",
"lib/compiling/papercomp.js"
],
RSrun: [
"lib/rapydscript/runtime.js"
],
RScompiler: [
"lib/rapydscript/compiler.js",
"lib/compiling/GScompiler.js",
"lib/compiling/acorn.es.js",
"lib/compiling/papercomp.js"
],
};

gulp.task('default', function() {
Expand All @@ -64,8 +67,8 @@ gulp.task('default', function() {
.pipe(gulp.dest('./lib/glow/'));

Object.keys(glowscript_libraries).forEach(function(lib) {
gulp.src(glowscript_libraries[lib])
.pipe(uglify())
return gulp.src(glowscript_libraries[lib])
.pipe(uglify().on('error', util.log)) // notice the error event here
.pipe(concat(lib + '.' + version + '.min.js'))
.pipe(header("/*This is a combined, compressed file. Look at https://github.com/BruceSherwood/glowscript for source code and copyright information.*/"))
.pipe(gulp.dest('./package/'));
Expand Down
16 changes: 8 additions & 8 deletions lib/compiling/GScompiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ where compile() was called, in untrusted/run.js.
// Replace arange with range (RapydScript-NG's range function handles floats):
if (lang != 'javascript') program = program.replace(r, changer)

function instring(n) {
for (var sb of string_bounds) {
if (n >= sb[0] && n <= sb[1]) return true
}
return false
}

lines = program.split('\n')
for (lineno=0; lineno<lines.length; lineno++) { // process individual lines of code

Expand Down Expand Up @@ -505,13 +512,6 @@ where compile() was called, in untrusted/run.js.
newprogram += ' '+indent+'sleep(0.2)\n'
}

function instring(n) {
for (var sb of string_bounds) {
if (n >= sb[0] && n <= sb[1]) return true
}
return false
}

if (lang != 'javascript') {
// When outdent line starts with ')', the element 'RS_ls = "N"' must be indented.
// When outdent line starts with 'else' or 'elif', at the same level as prevous line,
Expand Down Expand Up @@ -974,4 +974,4 @@ where compile() was called, in untrusted/run.js.
} // end of compile function
window.glowscript_compile = compile

})()
})()
5 changes: 3 additions & 2 deletions lib/glow/api_misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@
if (printarea === null) { // need to make a new printarea
var container = print_container
//container.css({float:"left"})
container.appendTo(poptions.place) // default is $('body'), below canvas (2.7)
//container.appendTo(poptions.place) // default is $('body'), below canvas (2.7)
container.appendTo($('body')) // default is $('body'), below canvas (2.7)
window.__context.print_container = container
printarea = $('<textarea id=print spellcheck="false"/>').appendTo(container).css('font-family', 'Verdana', 'Sans-Serif').css('font-size', '100%')
modify_printarea()
Expand Down Expand Up @@ -794,4 +795,4 @@
pytype
}
Export(exports)
})()
})()
4 changes: 2 additions & 2 deletions lib/glow/canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,12 +586,12 @@
userpan: true,
fov: 60*Math.PI/180,

width: { value: 640, onchanged: function() {
width: { value: 480, onchanged: function() {
this.__canvas_element.width = this.__canvas_element.style.width =
this.__overlay_element.width = this.__overlay_element.style.width = this.__width
//this.wrapper.width(this.__width + this.__drag_handle.width())
} },
height: { value: 400, onchanged: function() {
height: { value: 300, onchanged: function() {
this.__canvas_element.height = this.__canvas_element.style.height = this.__overlay_element.height =
this.__overlay_element.style.height = this.wrapper[0].style.height = this.__height
//this.__canvas_element.height = this.__canvas_element.style.height = this.__overlay_element.height = this.__overlay_element.style.height = this.__drag_handle[0].style.height = this.wrapper[0].style.height = this.__height
Expand Down
Loading

0 comments on commit a4cc0f2

Please sign in to comment.