Skip to content

Commit 9426e9e

Browse files
committed
background issue
1 parent 1c4a43e commit 9426e9e

File tree

2 files changed

+5
-41
lines changed

2 files changed

+5
-41
lines changed

mibbu-min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mibbu.js

+4-40
Original file line numberDiff line numberDiff line change
@@ -625,40 +625,8 @@ var mibbu = function(Cwidth, Cheight, _parent){
625625
**/
626626
var MB_Background = function(image, speed, direction, options) {
627627

628-
var draw = MB_usingCanvas ? function(){
629-
//draw Canvas
630-
try {
631-
var posX = t.posX % t.image.width,
632-
posY = t.posY % t.image.height;
633-
634-
for (var x = posX-t.image.width; x < MB_mainCanvas.width; x += t.image.width) {
635-
for (var y = posY-t.image.height; y < MB_mainCanvas.height; y += t.image.height) {
636-
MB_mainContext.i(t.image, x, y);
637-
}
638-
}
639-
640-
} catch(e) {};
641-
642-
if (t.dX < 0) {
643-
if (t.posX < (t.image.width*-1)) {
644-
t.posX = 0;
645-
}
646-
} else if (t.dX > 0) {
647-
if (t.posX > (t.image.width)) {
648-
t.posX = 0;
649-
}
650-
}
651-
if (t.dY < 0) {
652-
if (t.posY < (t.image.height*-1)) {
653-
t.posY = 0;
654-
}
655-
} else if (t.dY > 0) {
656-
if (t.posY > (t.image.height)) {
657-
t.posY = 0;
658-
}
659-
}
660-
} : function(){
661-
//draw DOM
628+
var draw = function(){
629+
//draw DOM & Canvas
662630
// If the values are too close to 0 JS will print them as exponentials
663631
// which won't work on the DOM. There's probably a more efficient way to
664632
// do this.
@@ -672,13 +640,9 @@ var mibbu = function(Cwidth, Cheight, _parent){
672640
t = this;
673641

674642
var setImage = function(img) {
675-
if (MB_usingCanvas) {
676-
t.image = new Image();
677-
t.image.src = img;
678-
} else {
679-
MB_mainCanvas.style.backgroundImage = 'url('+img+')';
680-
}
643+
MB_mainCanvas.style.backgroundImage = 'url('+img+')';
681644
};
645+
682646
setImage(image);
683647

684648
t.speed = speed || 3;

0 commit comments

Comments
 (0)