I am using angular to make a deep copy of a canvas object, and I am getting Uncaught InvalidStateError: Failed to read the 'selectionDirection' property from 'HTMLInputElement': The input element's type ('checkbox') does not support selection.
canvas = document.getElementById('workercanvas')
canvas.width = cfg.labelsImage.width
canvas.height = cfg.labelsImage.height
ctx = canvas.getContext('2d')
clonedCanvas = null
if clonedCanvas is null
clonedCanvas = angular.copy(canvas)
Any thoughts? Can angular.copy copy DOM elements?
UPDATE: use angular.element.clone I tried using angular.element.clone, the problem with that is that it seems that it doesnt make a deep copy, I have the following:
imgObj = new Image(imgWidth, imgHeight)
imgObj.onload = ->
ctx.drawImage(imgObj, 0, 0, imgWidth, imgHeight)
if clonedCanvas is null
clonedCanvas = angular.element.clone(canvas)
clonedImg = angular.element.clone(imgObj)
clonedCanvasContext = clonedCanvas.getContext('2d')
clonedCanvasContext.drawImage(clonedImg, 0, 0, imgWidth, imgHeight)
When I am changing the imgObj this also affects the clonedImg and changes the clonedCanvas, I want somehow to keep the original information. Is angular.element.clone
make a deep copy?