Add an option to prevent zoom influence on cavas alpha

This commit is contained in:
daine
2018-04-30 14:15:38 +02:00
parent 46639c0d77
commit acce5efb41
2 changed files with 10 additions and 2 deletions

View File

@@ -2805,6 +2805,7 @@ function LGraphCanvas( canvas, graph, options )
this.max_zoom = 10;
this.min_zoom = 0.1;
this.zoom_modify_alpha = false;
this.title_text_font = "bold 14px Arial";
this.inner_text_font = "normal 12px Arial";
@@ -4505,7 +4506,10 @@ LGraphCanvas.prototype.drawBackCanvas = function()
//render BG
if(this.background_image && this.scale > 0.5)
{
ctx.globalAlpha = (1.0 - 0.5 / this.scale) * this.editor_alpha;
if (zoom_modify_alpha)
ctx.globalAlpha = (1.0 - 0.5 / this.scale) * this.editor_alpha;
else
ctx.globalAlpha = this.editor_alpha;
ctx.imageSmoothingEnabled = ctx.mozImageSmoothingEnabled = ctx.imageSmoothingEnabled = false;
if(!this._bg_img || this._bg_img.name != this.background_image)
{

View File

@@ -2803,6 +2803,7 @@ function LGraphCanvas( canvas, graph, options )
this.max_zoom = 10;
this.min_zoom = 0.1;
this.zoom_modify_alpha = false;
this.title_text_font = "bold 14px Arial";
this.inner_text_font = "normal 12px Arial";
@@ -4503,7 +4504,10 @@ LGraphCanvas.prototype.drawBackCanvas = function()
//render BG
if(this.background_image && this.scale > 0.5)
{
ctx.globalAlpha = (1.0 - 0.5 / this.scale) * this.editor_alpha;
if (zoom_modify_alpha)
ctx.globalAlpha = (1.0 - 0.5 / this.scale) * this.editor_alpha;
else
ctx.globalAlpha = this.editor_alpha;
ctx.imageSmoothingEnabled = ctx.mozImageSmoothingEnabled = ctx.imageSmoothingEnabled = false;
if(!this._bg_img || this._bg_img.name != this.background_image)
{