1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-11-25 18:33:11 +00:00

isMobileDevice shrinks gutters

This commit is contained in:
Steven Hugg 2020-10-07 13:04:17 -05:00
parent e81f6989ce
commit 3041b08ae0
2 changed files with 8 additions and 5 deletions

View File

@ -2074,7 +2074,7 @@ function revealTopBar() {
export function setupSplits() { export function setupSplits() {
const splitName = 'workspace-split3-' + platform_id; const splitName = 'workspace-split3-' + platform_id;
var sizes = [0, 50, 50]; var sizes = [0, 50, 50];
if (!platform_id.startsWith('vcs') && !qs['embed']) if (!(platform_id.startsWith('vcs') || qs['embed'] || Views.isMobileDevice))
sizes = [12, 44, 44]; sizes = [12, 44, 44];
var sizesStr = hasLocalStorage && localStorage.getItem(splitName); var sizesStr = hasLocalStorage && localStorage.getItem(splitName);
if (sizesStr) { if (sizesStr) {

View File

@ -1,12 +1,12 @@
//import CodeMirror = require("codemirror"); //import CodeMirror = require("codemirror");
import { SourceFile, WorkerError, Segment, FileData, SourceLocation, SourceLine } from "../common/workertypes"; import { SourceFile, WorkerError, Segment, FileData, SourceLocation, SourceLine } from "../common/workertypes";
import { Platform, EmuState, lookupSymbol, BaseDebugPlatform, BaseZ80MachinePlatform, BaseZ80Platform, CpuState } from "../common/baseplatform"; import { BaseZ80MachinePlatform, BaseZ80Platform } from "../common/baseplatform";
import { hex, lpad, rpad, safeident, rgb2bgr } from "../common/util"; import { hex, lpad, rpad, safeident, rgb2bgr } from "../common/util";
import { CodeAnalyzer } from "../common/analysis"; import { CodeAnalyzer } from "../common/analysis";
import { platform, platform_id, compparams, current_project, lastDebugState, projectWindows, runToPC } from "./ui"; import { platform, platform_id, compparams, current_project, lastDebugState, projectWindows, runToPC } from "./ui";
import { ProbeRecorder, ProbeFlags } from "../common/recorder"; import { ProbeRecorder, ProbeFlags } from "../common/recorder";
import { getMousePos, dumpRAM, Toolbar } from "../common/emu"; import { getMousePos, dumpRAM } from "../common/emu";
import * as pixed from "./pixeleditor"; import * as pixed from "./pixeleditor";
declare var Mousetrap; declare var Mousetrap;
@ -29,6 +29,9 @@ export interface ProjectView {
undoStep?() : void; undoStep?() : void;
}; };
// detect mobile (https://stackoverflow.com/questions/3514784/what-is-the-best-way-to-detect-a-mobile-device)
export var isMobileDevice = window.matchMedia("only screen and (max-width: 760px)").matches;
declare var CodeMirror; declare var CodeMirror;
declare var VirtualList; declare var VirtualList;
@ -115,10 +118,10 @@ export class SourceEditor implements ProjectView {
var isAsm = isAsmOverride || modedef.isAsm; var isAsm = isAsmOverride || modedef.isAsm;
var lineWrap = !!modedef.lineWrap; var lineWrap = !!modedef.lineWrap;
var theme = modedef.theme || MODEDEFS.default.theme; var theme = modedef.theme || MODEDEFS.default.theme;
var lineNums = !modedef.noLineNumbers; var lineNums = !modedef.noLineNumbers && !isMobileDevice;
var gutters = ["CodeMirror-linenumbers", "gutter-offset", "gutter-info"]; var gutters = ["CodeMirror-linenumbers", "gutter-offset", "gutter-info"];
if (isAsm) gutters = ["CodeMirror-linenumbers", "gutter-offset", "gutter-bytes", "gutter-clock", "gutter-info"]; if (isAsm) gutters = ["CodeMirror-linenumbers", "gutter-offset", "gutter-bytes", "gutter-clock", "gutter-info"];
if (modedef.noGutters) gutters = ["gutter-info"]; if (modedef.noGutters || isMobileDevice) gutters = ["gutter-info"];
this.editor = CodeMirror(parent, { this.editor = CodeMirror(parent, {
theme: theme, theme: theme,
lineNumbers: lineNums, lineNumbers: lineNums,