Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ForInstalledPython/glow.min.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion GlowScriptOffline/glowscript_libraries/compiler.3.0.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion GlowScriptOffline/glowscript_libraries/glow.3.0.min.js

Large diffs are not rendered by default.

Binary file modified GlowScriptOffline3.0.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion build_original_no_overload.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
##shader_file = "\n".join(shader_file)
##open("lib/glow/shaders.gen.js", "wb").write(shader_file)

version = "2.9"
version = "3.0"
# TODO: Extract this information from run.js

glowscript_libraries = {
Expand Down
2 changes: 1 addition & 1 deletion lib/compiling/GScompiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,7 @@ where compile() was called, in untrusted/run.js.
// Python and VPython key words that can be preceded by 'xxx.'
// 'defineProperties' is a RapydScript-NG element.
var no_await2 = ['remove', 'select', 'append_to_title', 'append_to_caption', 'bind', 'unbind', 'call',
'rgb_to_hsv', 'hsv_to_rgb', 'mag', 'mag2', 'norm', 'hat', 'rotate', 'random', 'pow',
'rgb_to_hsv', 'hsv_to_rgb', 'mag', 'mag2', 'norm', 'hat', 'rotate', 'random', 'pow', 'equals',
'format', 'trigger', 'follow', 'defineProperties', 'textures', 'bumpmaps']

// If not a user function, nor pause/waitfor/rate/sleep/read_local_file/get_library,
Expand Down
20 changes: 14 additions & 6 deletions lib/glow/primitives.js
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@
})

function arrow_update(obj) {
let save = obj.__oldaxis // obj.__oldaxis gets set to undefined during shaft and tip manipulations
var pos = obj.__pos
var color = obj.__color
let axis = obj.__axis
Expand All @@ -771,29 +772,36 @@
var components = obj.__components
if (!components) {
components = obj.__components = [box({ canvas:obj.canvas, __obj:obj }),
pyramid({ canvas:obj.canvas, __obj:obj })]
}
pyramid({ canvas:obj.canvas, __obj:obj })]
components[0].__oldaxis = undefined
components[1].__oldaxis = undefined
if (axis.mag2 == 0) {
components[0].__oldaxis = vec(1,0,0)
components[1].__oldaxis = vec(1,0,0)
}
}
var shaft = components[0]
var tip = components[1]

shaft.pos = pos.add(A.multiply(.5 * (L - hl)))
tip.pos = pos.add(A.multiply(L - hl))
// axis and up have already been adjusted if necessary for the arrow composite (virtual) object:
//window.__adjustupaxis = false
console.log(axis, obj.__up)
window.__adjustupaxis = false
shaft.axis = tip.axis = axis
shaft.up = tip.up = obj.__up
//window.__adjustupaxis = true
shaft.__oldaxis = tip.__oldaxis = undefined
window.__adjustupaxis = true
shaft.size = vec(L - hl, sw, sw)
tip.size = vec(hl, hw, hw)
shaft.color = tip.color = obj.color
shaft.opacity = tip.opacity = obj.opacity
shaft.pickable = tip.pickable = obj.pickable

obj.size = vec(L, hw, hw)
obj.size = vec(L, hw, hw)

shaft.__update()
tip.__update()
obj.__oldaxis = save
}

/*
Expand Down
21 changes: 16 additions & 5 deletions lib/glow/vectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,27 @@
attributeVectorPos.prototype.constructor = attributeVectorPos

function attributeVectorAxis(parent, x, y, z) { // for axis in both VPython and JS/RS environments
var oldaxis
this.__parent = parent
if (parent) oldaxis = norm(parent.__axis)
let currentaxis
if (parent) currentaxis = vec(parent.__axis)
this.__x = x
this.__y = y
this.__z = z
if (parent) {
if (parent.__sizing) parent.__size.__x = Math.sqrt(x*x + y*y + z*z) // Not sphere or ring or text or compound
// Do not adjust up if in the process of rotating an object:
if (window.__adjustupaxis) adjust_up(parent, oldaxis, this)
parent.__axis = this
let m = Math.sqrt(x*x + y*y + z*z)
if (parent.__sizing) parent.__size.__x = m // Not sphere or ring or text or compound
if (m === 0) {
if (parent.__oldaxis === undefined ) parent.__oldaxis = currentaxis
} else {
if (parent.__oldaxis !== undefined) {
currentaxis = parent.__oldaxis
parent.__oldaxis = undefined
}
// Do not adjust up if in the process of rotating an object
if (window.__adjustupaxis) adjust_up(parent, currentaxis, this)
}

parent.__change()
}
}
Expand Down
2 changes: 1 addition & 1 deletion package/RScompiler.3.0.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package/compiler.3.0.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package/glow.3.0.min.js

Large diffs are not rendered by default.