Improved brush
This commit is contained in:
parent
82b891cce2
commit
43b7746845
@ -83,6 +83,7 @@ function Cursor(rune)
|
||||
ronin.cursor.mode = "vertex";
|
||||
|
||||
ronin.cursor.query = ronin.commander.input_el.value;
|
||||
ronin.brush.absolute_thickness = 0;
|
||||
}
|
||||
|
||||
this.mouse_alt = function(e)
|
||||
|
@ -38,7 +38,7 @@ function Brush()
|
||||
var ratio = clamp(1 - (ronin.brush.speed/20),0,1)
|
||||
var t = ronin.cursor.size * ratio;
|
||||
this.absolute_thickness = t > this.absolute_thickness ? this.absolute_thickness+0.25 : this.absolute_thickness-0.25;
|
||||
return this.absolute_thickness * 3;
|
||||
return this.absolute_thickness;
|
||||
}
|
||||
|
||||
this.stroke = function(line)
|
||||
@ -88,11 +88,6 @@ function Pointer(options)
|
||||
{
|
||||
this.options = options;
|
||||
|
||||
this.thickness = function(line)
|
||||
{
|
||||
return ronin.brush.thickness(line);
|
||||
}
|
||||
|
||||
this.stroke = function(line,erase = false)
|
||||
{
|
||||
var ctx = ronin.cursor.target.context();
|
||||
@ -111,7 +106,7 @@ function Pointer(options)
|
||||
ctx.moveTo((line.from.x * 2) + this.options.offset.x,(line.from.y * 2) + this.options.offset.y);
|
||||
ctx.lineTo((line.to.x * 2) + this.options.offset.x,(line.to.y * 2) + this.options.offset.y);
|
||||
ctx.lineCap="round";
|
||||
ctx.lineWidth = this.thickness(line);
|
||||
ctx.lineWidth = ronin.brush.thickness(line);
|
||||
ctx.strokeStyle = ronin.brush.swatch.color();
|
||||
ctx.stroke();
|
||||
ctx.closePath();
|
||||
|
@ -118,10 +118,12 @@ window.addEventListener('drop', function(e)
|
||||
|
||||
var files = e.dataTransfer.files;
|
||||
var file = files[0];
|
||||
var path = file.path ? file.path : file.name;
|
||||
|
||||
if(path.substr(-4,4) == ".thm"){ return; }
|
||||
|
||||
if (file.type && !file.type.match(/image.*/)) { console.log("Not image", file.type); return false; }
|
||||
|
||||
var path = file.path ? file.path : file.name;
|
||||
var reader = new FileReader();
|
||||
|
||||
reader.onload = function(event)
|
||||
|
Loading…
x
Reference in New Issue
Block a user