Skip to content
Snippets Groups Projects
Commit 00a1b6fc authored by Neil Gershenfeld's avatar Neil Gershenfeld
Browse files

wip

parent 93fbac4a
Branches
No related tags found
No related merge requests found
......@@ -32,10 +32,7 @@ var init = function() {
mod.latency.value = 15
mod.delay.value = 1
mod.dpi = 100
//
// open window for last image
//
open_window()
mod.win = null
//
// trigger image after latency (for start-up)
//
......@@ -98,6 +95,33 @@ var interface = function(div){
//
var canvas = document.createElement('canvas')
mod.lastimg = canvas
div.appendChild(document.createElement('br'))
//
// view button
//
var btn = document.createElement('button')
btn.style.padding = mods.ui.padding
btn.style.margin = 1
btn.appendChild(document.createTextNode('view last image'))
btn.addEventListener('click',function(){
mod.win = window.open('')
mod.win.document.title = 'motion detect last image'
mod.win.document.body.style.overflow = 'hidden'
mod.win.document.body.style.border = 0
mod.win.document.body.style.padding = 0
mod.win.document.body.style.margin = 0
mod.win.addEventListener('unload',function() {
mod.win = null
})
var canvas = document.createElement('canvas')
canvas.width = mod.img.width
canvas.height = mod.img.height
canvas.setAttribute('id',mod.div.id+'canvas')
mod.win.document.body.appendChild(canvas)
var ctx = canvas.getContext("2d")
ctx.drawImage(mod.img,0,0)
})
div.appendChild(btn)
//
// info div
//
......@@ -220,12 +244,14 @@ function compare_images() {
//
// update view window
//
if (mod.win != null) {
var canvas = mod.win.document.getElementById(mod.div.id+'canvas')
canvas.width = mod.img.width
canvas.height = mod.img.height
var ctx = canvas.getContext("2d")
ctx.clearRect(0,0,mod.img.width,mod.img.height)
ctx.drawImage(mod.img,0,0)
}
//
// terminate worker
//
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment