Allow middle-click scrolling

main
Isaiah Odhner 2018-01-11 18:17:01 -05:00
parent 37bf2655ec
commit f86234c051
4 changed files with 8 additions and 3 deletions

View File

@ -58,8 +58,6 @@ then switch back to the magnifier, the toolbar doesn't show any magnification hi
* Can't glide thru tool options in Firefox, mobile Chrome;
might be a pointer events spec interpretation issue, and it could easily be that the more technically correct browsers are where it's not working
(Note: not a thing allowed by MS Paint)
* Middle-click scrolling is prevented
(Note: not a thing allowed by MS Paint)
### Menus

View File

@ -96,7 +96,7 @@ Selection.prototype.cut_out_background = function(){
var sel = this;
var cutout = sel.canvas;
if(transparency){
// @FIXME: this doesn't work well with transparency between 0 and 1
// @FIXME: this doesn't work well with nonbinary transparency
ctx.save();
ctx.globalCompositeOperation = "destination-out";
ctx.drawImage(cutout, sel.x, sel.y);

View File

@ -583,6 +583,9 @@ $app
){
return;
}
if(e.button === 1){
return; // allow middle-click scrolling
}
e.preventDefault();
});

View File

@ -473,6 +473,10 @@ tools = [{
ctx.fillRect(x, y, w, h);
}
if(this.$options.stroke){
// FIXME: can draw 1x2 or 2x1 pixels of a rectangle with a stroke of 1px (the default)
// which doesn't get drawn at full opacity
// or more generally, a 0-width or 0-height rectangle gives
// non-full-opacity pixels at either side of the resulting line drawn
if((stroke_size % 2) === 1){
ctx.strokeRect(x-0.5, y-0.5, w, h);
}else{