diff --git a/src/iframework.js b/src/iframework.js
index 472d3c7..7681d10 100644
--- a/src/iframework.js
+++ b/src/iframework.js
@@ -351,8 +351,8 @@ $(function(){
var graphEl = this.$(".graph");
this.shownGraph.addNode({
"src": url,
- "x": graphEl.scrollLeft() + graphEl.width()/2 - 100,
- "y": graphEl.scrollTop() + graphEl.height()/2 - 100
+ "x": Math.floor(graphEl.scrollLeft() + graphEl.width()/2) - 100,
+ "y": Math.floor(graphEl.scrollTop() + graphEl.height()/2) - 100
});
this.$(".addbyurlinput")
.val("")
diff --git a/src/node-box-native-view.js b/src/node-box-native-view.js
index 804c1d0..dae0afb 100644
--- a/src/node-box-native-view.js
+++ b/src/node-box-native-view.js
@@ -53,12 +53,14 @@ $(function(){
// Do everything that will cause a redraw here
},
_triggerRedraw: false,
+ _lastRedraw: 0,
renderAnimationFrame: function (timestamp) {
// Get a tick from GraphView.renderAnimationFrame()
// this._valueChanged is set by NodeBox.receive()
if (this._triggerRedraw) {
this._triggerRedraw = false;
this.redraw(timestamp);
+ this._lastRedraw = timestamp;
}
},
send: function (name, value) {
diff --git a/src/nodes/image-cam.js b/src/nodes/image-cam.js
index 8d84914..13d724c 100644
--- a/src/nodes/image-cam.js
+++ b/src/nodes/image-cam.js
@@ -200,7 +200,7 @@ $(function(){
this.resetSizes = false;
}
},
- _lastTime: 0,
+ _lastRedraw: 0,
renderAnimationFrame: function (timestamp) {
// Get a tick from GraphView.renderAnimationFrame()
// this._valueChanged is set by NodeBox.receive()
@@ -209,9 +209,9 @@ $(function(){
this.redraw(timestamp);
}
if (this._fps && this._ms) {
- if (timestamp-this._lastTime >= this._ms) {
+ if (timestamp-this._lastRedraw >= this._ms) {
this.drawFrame();
- this._lastTime = timestamp;
+ this._lastRedraw = timestamp;
}
}
},
diff --git a/src/nodes/image-combine.js b/src/nodes/image-combine.js
deleted file mode 100644
index 33181ed..0000000
--- a/src/nodes/image-combine.js
+++ /dev/null
@@ -1,55 +0,0 @@
-// extends src/nodes/image.js which extends src/node-box-native-view.js
-
-$(function(){
-
- Iframework.NativeNodes["image-combine"] = Iframework.NativeNodes["image"].extend({
-
- info: {
- title: "image-combine",
- description: "native module test"
- },
- initializeModule: function(){
-
- },
- inputimage: function (image) {
- // This should happen in port eventually
- switch(Iframework.util.type(image)) {
- case "ImageData" :
- this.context.putImageData(image, 0, 0);
- break;
- case "HTMLCanvasElement" :
- this.context.drawImage(image, 0, 0);
- break;
- default :
- break;
- }
- this.send("image", this.canvas);
- },
- renderAnimationFrame: function () {
- //
- },
- inputbang: function (i) {
- this.$(".info").append("! ");
- this.send("bang", "!");
- },
- inputs: {
- image: {
- type: "image"
- },
- bang: {
- type: "bang"
- }
- },
- outputs: {
- image: {
- type: "image"
- },
- bang: {
- type: "bang"
- }
- }
-
- });
-
-
-});
diff --git a/src/nodes/image.js b/src/nodes/image.js
index bf2c964..7a69100 100644
--- a/src/nodes/image.js
+++ b/src/nodes/image.js
@@ -22,8 +22,6 @@ $(function(){
self.popout();
})
);
- // Add refresh event
- // this.events["click .refresh"] = "refresh";
this.canvas = document.createElement("canvas");
this.canvas.width = 500;
diff --git a/src/nodes/video-player.js b/src/nodes/video-player.js
index 6688370..5180dc1 100644
--- a/src/nodes/video-player.js
+++ b/src/nodes/video-player.js
@@ -162,6 +162,7 @@ $(function(){
this.drawFrame();
this.send("time", currentTime);
this._lastTimeSent = currentTime;
+ this._lastRedraw = timestamp;
}
},
inputs: {
diff --git a/src/nodes/view-layers.js b/src/nodes/view-layers.js
new file mode 100644
index 0000000..1d380a8
--- /dev/null
+++ b/src/nodes/view-layers.js
@@ -0,0 +1,99 @@
+// extends src/nodes/image.js which extends src/node-box-native-view.js
+
+$(function(){
+
+ var template =
+ '
'+
+ '';
+
+ Iframework.NativeNodes["view-layers"] = Iframework.NativeNodes["view"].extend({
+
+ info: {
+ title: "layers",
+ description: "can get any of the canvases in the graph and make a stack of them"
+ },
+ template: _.template(template),
+ events: {
+ "change .vis": "setVis"
+ },
+ initializeModule: function(){
+ // Hide old
+ $(this.canvas).hide();
+ // Make list
+ var list = $('