fix: elements and network scale

This commit is contained in:
redhoodsu
2023-03-03 19:01:56 +08:00
parent 4b3d061619
commit db0b48c82a
3 changed files with 22 additions and 5 deletions

View File

@@ -62,10 +62,10 @@
"karma-jquery": "^0.2.4", "karma-jquery": "^0.2.4",
"karma-sourcemap-loader": "^0.3.7", "karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^5.0.0", "karma-webpack": "^5.0.0",
"licia": "^1.37.1", "licia": "^1.38.0",
"luna-box-model": "^0.1.0", "luna-box-model": "^0.1.0",
"luna-console": "^1.3.0", "luna-console": "^1.3.0",
"luna-data-grid": "^0.4.0", "luna-data-grid": "^0.4.3",
"luna-dom-viewer": "^1.2.3", "luna-dom-viewer": "^1.2.3",
"luna-modal": "^1.0.0", "luna-modal": "^1.0.0",
"luna-notification": "^0.1.4", "luna-notification": "^0.1.4",

View File

@@ -14,6 +14,7 @@ import { isErudaEl, classPrefix as c, isChobitsuEl } from '../lib/util'
import evalCss from '../lib/evalCss' import evalCss from '../lib/evalCss'
import Detail from './Detail' import Detail from './Detail'
import chobitsu from '../lib/chobitsu' import chobitsu from '../lib/chobitsu'
import emitter from '../lib/emitter'
import { formatNodeName } from './util' import { formatNodeName } from './util'
export default class Elements extends Tool { export default class Elements extends Tool {
@@ -79,6 +80,7 @@ export default class Elements extends Tool {
destroy() { destroy() {
super.destroy() super.destroy()
emitter.off(emitter.SCALE, this._updateScale)
evalCss.remove(this._style) evalCss.remove(this._style)
this._detail.destroy() this._detail.destroy()
chobitsu chobitsu
@@ -205,6 +207,11 @@ export default class Elements extends Tool {
this._splitMode = false this._splitMode = false
this._detail.hide() this._detail.hide()
}) })
emitter.on(emitter.SCALE, this._updateScale)
}
_updateScale = (scale) => {
this._splitMediaQuery.setQuery(`screen and (min-width: ${680 * scale}px)`)
} }
_deleteNode = () => { _deleteNode = () => {
const node = this._curNode const node = this._curNode

View File

@@ -8,6 +8,7 @@ import throttle from 'licia/throttle'
import { getFileName, classPrefix as c } from '../lib/util' import { getFileName, classPrefix as c } from '../lib/util'
import evalCss from '../lib/evalCss' import evalCss from '../lib/evalCss'
import chobitsu from '../lib/chobitsu' import chobitsu from '../lib/chobitsu'
import emitter from '../lib/emitter'
import LunaDataGrid from 'luna-data-grid' import LunaDataGrid from 'luna-data-grid'
import ResizeSensor from 'licia/ResizeSensor' import ResizeSensor from 'licia/ResizeSensor'
import MediaQuery from 'licia/MediaQuery' import MediaQuery from 'licia/MediaQuery'
@@ -97,9 +98,11 @@ export default class Network extends Tool {
return ret return ret
} }
_updateDataGridHeight() { _updateDataGridHeight() {
const height = this._$el.offset().height - 41 const height = this._$el.offset().height - this._$control.offset().height
this._requestDataGrid.setOption('minHeight', height) this._requestDataGrid.setOption({
this._requestDataGrid.setOption('maxHeight', height) minHeight: height,
maxHeight: height,
})
} }
_reqWillBeSent = (params) => { _reqWillBeSent = (params) => {
if (!this._isRecording) { if (!this._isRecording) {
@@ -319,6 +322,11 @@ export default class Network extends Tool {
network.on('responseReceivedExtraInfo', this._resReceivedExtraInfo) network.on('responseReceivedExtraInfo', this._resReceivedExtraInfo)
network.on('responseReceived', this._resReceived) network.on('responseReceived', this._resReceived)
network.on('loadingFinished', this._loadingFinished) network.on('loadingFinished', this._loadingFinished)
emitter.on(emitter.SCALE, this._updateScale)
}
_updateScale = (scale) => {
this._splitMediaQuery.setQuery(`screen and (min-width: ${680 * scale}px)`)
} }
destroy() { destroy() {
super.destroy() super.destroy()
@@ -332,6 +340,8 @@ export default class Network extends Tool {
network.off('responseReceivedExtraInfo', this._resReceivedExtraInfo) network.off('responseReceivedExtraInfo', this._resReceivedExtraInfo)
network.off('responseReceived', this._resReceived) network.off('responseReceived', this._resReceived)
network.off('loadingFinished', this._loadingFinished) network.off('loadingFinished', this._loadingFinished)
emitter.off(emitter.SCALE, this._updateScale)
} }
_initTpl() { _initTpl() {
const $el = this._$el const $el = this._$el