more keyboard and mouse events for cbr.js

This commit is contained in:
j 2015-03-14 16:30:58 +05:30
parent d534769b70
commit 2b1dc4f24e

View file

@ -91,19 +91,57 @@ cbrjs.CBRViewer = function(options, self) {
page: 1 page: 1
}) })
}, },
singleclick: function() { key_n: function() {
//left part previous self.fitMode = 'N';
//that.options({ resize();
// page: Math.min(self.options.page - 1, self.pages.length) },
//}) key_h: function() {
//right part next self.fitMode = 'H';
resize();
},
key_b: function() {
self.fitMode = 'B';
resize();
},
key_w: function() {
self.fitMode = 'W';
resize();
},
key_l: function() {
self.rotateTimes--;
if (self.rotateTimes < 0) {
self.rotateTimes = 3;
}
setPage();
},
key_f: function() {
if (!self.hflip && !self.vflip) {
self.hflip = true;
} else if(self.hflip == true) {
self.vflip = true;
self.hflip = false;
} else if(self.vflip == true) {
self.vflip = false;
}
setPage();
},
singleclick: function(data) {
if (data.clientX < (that.width() / 2)) {
that.options({
page: Math.max(self.options.page - 1, 1)
});
} else {
that.options({ that.options({
page: Math.min(self.options.page + 1, self.pages.length) page: Math.min(self.options.page + 1, self.pages.length)
}) });
}
} }
}) })
.css({ .css({
textAlign: 'center', margin: 0,
overflow: 'auto',
padding: 0,
textAlign: 'center'
}); });
self.$canvas = Ox.Element('<canvas>') self.$canvas = Ox.Element('<canvas>')
.appendTo(self.$frame); .appendTo(self.$frame);
@ -260,7 +298,7 @@ cbrjs.CBRViewer = function(options, self) {
canvas.style.height = ''; canvas.style.height = '';
canvas.style.maxWidth = ''; canvas.style.maxWidth = '';
canvas.style.maxHeight = ''; canvas.style.maxHeight = '';
var maxheight = that.height() - 16; var maxheight = self.$frame.height() - 4;
if (clear || self.fitMode == 'N') { if (clear || self.fitMode == 'N') {
} else if (self.fitMode == 'B') { } else if (self.fitMode == 'B') {