2012-06-15 35 views
3

Pixastic和我的畫布偵聽器之間有一個奇怪的衝突。使用Pixastic插件後Canvas偵聽器不工作

當我在畫布上使用Pixastic函數時,此操作後畫布的偵聽器不起作用。我使用Pixastic插件分析了我的畫布,並發現pixastic添加了一些屬性,如tabindex(我認爲與聽衆衝突)。

這是我的畫布前,後:

//Before 
<canvas id="mycanvas" width="727" height="600" style="border: 1px solid black; left: 36.5px; top: 21px;"></canvas> 

//After 
<canvas id="mycanvas" class="" width="600" height="727" style="border: 1px solid black; left: 36.5px; top: 21px;" title="" tabindex="-1"></canvas> 

我用的聽衆mousedownmouseupmousemove。有人可以幫助我嗎?

+0

在某些情況下,Pixastic將替換畫布以顯示其結果。你確定它仍然是你的畫布嗎?我會嘗試通過直接在html代碼中添加一個像test =「imhere」這樣的多餘屬性。 – noiv

回答

0
Pixastic.process(canvas, 'brightness', 
{ 
    'brightness': 60, 
    'contrast': 0.5, 
    'leaveDOM': true 
}, 
function(img) { 
    ctx.drawImage(img, 0, 0); 
} 

);

檢查leaveDOM參數,它可能有所幫助。

0

在我的版本Pixastic的(0.1.3)有一個參數,它允許您設置目標帆布

試試這個

var canvas = document.querySelector('#my_canvas'); 
// Since you specify what canvas the result should be rendered to, 
// no replacing is occured 
Pixastic.process(canvas, 'brightness',{'resultCanvas': canvas}); 

console.log(canvas === document.querySelector('#my_canvas')); // Should be true 

不幸的是我不能檢查Pixastic的最新版本因爲該網站在發佈此文件時已關閉。

相關問題