Mobile app hotfix for touch events

This commit is contained in:
JannisX11 2023-04-17 22:10:08 +02:00
parent 2e8395b559
commit 20315bf016
5 changed files with 26 additions and 21 deletions

View File

@ -491,12 +491,12 @@ const Settings = {
new Setting('paint_through_transparency', {category: 'paint', value: true});
new Setting('paint_side_restrict', {category: 'paint', value: true});
new Setting('paint_with_stylus_only', {category: 'paint', value: false});
new Setting('brush_opacity_modifier', {category: 'paint', value: 'pressure', type: 'select', options: {
new Setting('brush_opacity_modifier', {category: 'paint', value: 'none', type: 'select', options: {
'pressure': tl('settings.brush_modifier.pressure'),
'tilt': tl('settings.brush_modifier.tilt'),
'none': tl('settings.brush_modifier.none'),
}});
new Setting('brush_size_modifier', {category: 'paint', value: 'tilt', type: 'select', options: {
new Setting('brush_size_modifier', {category: 'paint', value: 'none', type: 'select', options: {
'pressure': tl('settings.brush_modifier.pressure'),
'tilt': tl('settings.brush_modifier.tilt'),
'none': tl('settings.brush_modifier.none'),
@ -542,6 +542,11 @@ const Settings = {
new Setting('model_export_scale', {category: 'export', value: 16, type: 'number', min: 0.0001, max: 4096});
new Setting('sketchfab_token', {category: 'export', value: '', type: 'password'});
new Setting('credit', {category: 'export', value: 'Made with Blockbench', type: 'text'});
Blockbench.onUpdateTo('4.7.1', () => {
settings.brush_opacity_modifier.set('none');
settings.brush_size_modifier.set('none');
})
},
setupProfiles() {
if (localStorage.getItem('settings_profiles') != null) {

View File

@ -724,7 +724,7 @@ class Preview {
Transformer.dispatchPointerHover(event);
}
if (Transformer.hoverAxis !== null) return;
let is_canvas_click = Keybinds.extra.preview_select.keybind.isTriggered(event) || event.which === 0;
let is_canvas_click = Keybinds.extra.preview_select.keybind.isTriggered(event) || event.button === 0;
var data = is_canvas_click && this.raycast(event);
if (data) {
@ -1032,21 +1032,6 @@ class Preview {
scope.raycaster.setFromCamera( scope.mouse, scope.camOrtho );
return scope.raycaster.ray.origin
}
occupyTransformer(event) {
if (this.offscreen || Transformer.dragging) return this;
Transformer.camera = this.isOrtho ? this.camOrtho : this.camPers
Transformer.orbit_controls = this.controls
Transformer.setCanvas(this.canvas)
main_preview.controls.updateSceneScale()
if (quad_previews) {
quad_previews.hovered = this;
}
if (event && event.type == 'touchstart') {
Transformer.simulateMouseDown(event);
}
return this;
}
showContextMenu(event) {
Prop.active_panel = 'preview';
if (this.static_rclick && (event.which === 3 || (event.type == 'touchend' && this.rclick_cooldown == true))) {
@ -1066,6 +1051,21 @@ class Preview {
delete this.rclick_cooldown;
return this;
}
occupyTransformer(event) {
if (this.offscreen || Transformer.dragging) return this;
Transformer.camera = this.isOrtho ? this.camOrtho : this.camPers
Transformer.orbit_controls = this.controls
Transformer.setCanvas(this.canvas)
main_preview.controls.updateSceneScale()
if (quad_previews) {
quad_previews.hovered = this;
}
if (event && event.type == 'touchstart') {
Transformer.simulateMouseDown(event);
}
return this;
}
calculateControlScale(position) {
if (this.isOrtho) {
return 0.35 / this.camera.zoom;

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
{
"name": "Blockbench",
"description": "Low-poly modeling and animation software",
"version": "4.7.0",
"version": "4.7.1",
"license": "GPL-3.0-or-later",
"author": {
"name": "JannisX11",

File diff suppressed because one or more lines are too long