mirror of
https://github.com/JannisX11/blockbench.git
synced 2025-04-06 17:31:09 +08:00
Fix manual color input in color panel not working
Make texture editing faster
This commit is contained in:
parent
275d916024
commit
5e14670ae0
@ -136,7 +136,7 @@ Interface.definePanels(() => {
|
||||
second_color_selected: false,
|
||||
get color_code() {return this.hover_color || (this.second_color_selected ? this.second_color : this.main_color)},
|
||||
set color_code(color) {
|
||||
if (this.second_color_selected) {
|
||||
if (this.second_color_selected == false) {
|
||||
this.main_color = color.toLowerCase().replace(/[^a-f0-9#]/g, '');
|
||||
} else {
|
||||
this.second_color = color.toLowerCase().replace(/[^a-f0-9#]/g, '');
|
||||
|
@ -38,7 +38,7 @@ class Texture {
|
||||
//Setup Img/Mat
|
||||
this.canvas = document.createElement('canvas');
|
||||
this.canvas.width = this.canvas.height = 16;
|
||||
this.ctx = this.canvas.getContext('2d');
|
||||
this.ctx = this.canvas.getContext('2d', {willReadFrequently: true});
|
||||
let img = this.img = new Image()
|
||||
img.src = 'assets/missing.png'
|
||||
|
||||
@ -1769,8 +1769,7 @@ class Texture {
|
||||
let target = Texture.all[Texture.all.indexOf(texture)-1];
|
||||
Undo.initEdit({textures: [target], bitmap: true});
|
||||
|
||||
target.edit(canvas => {
|
||||
let ctx = canvas.getContext('2d');
|
||||
target.edit((canvas, {ctx}) => {
|
||||
ctx.drawImage(texture.img, 0, 0);
|
||||
}, {no_undo: true})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user