In retrospect the approach to get x/y pos of canvas to create a krpano hotspot for showing in the canvas was not very clever.
It was a helper because I couldn't draw an image to the canvas.
In fact, the image was implemented, but it did not load and the screenshotcanvas already got created before the image loaded.
So trying around for some hours I finally managed to draw images where I want on the canvas with the very easy
drawImage and build a small preload function of the biggest image to load around all other drawImage, addlayer and fillText methods.
Jippie!
This seems really easy now that I know, haha.... damn. I wish I learned how to trace console.log before I tried around..
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
|
var pokal = new Image();
pokal.parent = "screenshot";
pokal.zorder = 5;
pokal.src = 'images/pokal.png';
pokal.onload = function () {
ctx.drawImage(pokal, screenshotcanvas.width / 2 - pokal.width / 2,screenshotcanvas.height / 2 - pokal.height / 2);
ctx.fillText(zfin, (screenshotcanvas.width/2), (screenshotcanvas.height/2));
ctx.drawImage(logo, 15, 15, 140, 71);
...
}
|