Browse Source

字体引用 / system.msg 消息提示方法

master
修宁 7 months ago
parent
commit
cbbe96ad36
  1. 46
      package.json
  2. 133
      pnpm-lock.yaml
  3. BIN
      src/assets/fonts/simsunb.ttf
  4. 5
      src/core/ModelUtils.ts
  5. 4
      src/core/base/BaseRenderer.ts
  6. 4
      src/core/manager/InteractionManager.ts
  7. 1
      src/core/manager/ModuleManager.ts
  8. 30
      src/modules/measure/MeasureRenderer.ts
  9. 65
      src/runtime/System.ts

46
package.json

@ -12,28 +12,7 @@
"format": "prettier --write src/" "format": "prettier --write src/"
}, },
"dependencies": { "dependencies": {
"@vueuse/core": "^13.2.0", "@vueuse/core": "^13.2.0"
"ag-grid-community": "^28.2.1",
"ag-grid-enterprise": "^28.2.1",
"ag-grid-vue3": "^28.2.1",
"axios": "^1.9.0",
"codemirror": "^5.65.19",
"dat.gui": "^0.7.9",
"decimal.js": "^10.5.0",
"element-plus": "^2.9.10",
"hotkeys-js": "^3.13.10",
"jquery": "^3.6.0",
"json5": "^2.2.3",
"less": "^4.2.1",
"localforage": "^1.10.0",
"lodash": "^4.17.21",
"pinia": "^3.0.1",
"sortablejs": "1.15.6",
"split.js": "^1.6.4",
"vue": "^3.5.13",
"vue-i18n": "9.2.2",
"vue-router": "^4.5.0",
"vue3-menus": "^1.1.2"
}, },
"devDependencies": { "devDependencies": {
"@element-plus/icons-vue": "^2.3.1", "@element-plus/icons-vue": "^2.3.1",
@ -60,6 +39,27 @@
"vue-tsc": "^2.2.8", "vue-tsc": "^2.2.8",
"three": "^0.176.0", "three": "^0.176.0",
"camera-controls": "2.10.1", "camera-controls": "2.10.1",
"three-mesh-bvh": "^0.9.0" "three-mesh-bvh": "^0.9.0",
"ag-grid-community": "^28.2.1",
"ag-grid-enterprise": "^28.2.1",
"ag-grid-vue3": "^28.2.1",
"axios": "^1.9.0",
"codemirror": "^5.65.19",
"dat.gui": "^0.7.9",
"decimal.js": "^10.5.0",
"element-plus": "^2.9.10",
"hotkeys-js": "^3.13.10",
"jquery": "^3.6.0",
"json5": "^2.2.3",
"less": "^4.2.1",
"localforage": "^1.10.0",
"lodash": "^4.17.21",
"pinia": "^3.0.1",
"sortablejs": "1.15.6",
"split.js": "^1.6.4",
"vue": "^3.5.13",
"vue-i18n": "9.2.2",
"vue-router": "^4.5.0",
"vue3-menus": "^1.1.2"
} }
} }

133
pnpm-lock.yaml

@ -11,6 +11,43 @@ importers:
'@vueuse/core': '@vueuse/core':
specifier: ^13.2.0 specifier: ^13.2.0
version: 13.2.0(vue@3.5.14(typescript@5.8.3)) version: 13.2.0(vue@3.5.14(typescript@5.8.3))
devDependencies:
'@element-plus/icons-vue':
specifier: ^2.3.1
version: 2.3.1(vue@3.5.14(typescript@5.8.3))
'@rolldown/pluginutils':
specifier: 1.0.0-beta.8-commit.56abf23
version: 1.0.0-beta.8-commit.56abf23
'@tsconfig/node22':
specifier: ^22.0.1
version: 22.0.2
'@types/jquery':
specifier: ^3.3.31
version: 3.5.32
'@types/lodash':
specifier: ^4.17.7
version: 4.17.17
'@types/node':
specifier: ^22.14.0
version: 22.15.21
'@types/three':
specifier: ^0.176.0
version: 0.176.0
'@vicons/antd':
specifier: ^0.13.0
version: 0.13.0
'@vicons/fa':
specifier: ^0.12.0
version: 0.12.0
'@vitejs/plugin-vue':
specifier: ^5.2.3
version: 5.2.4(vite@6.3.5(@types/node@22.15.21)(less@4.3.0))(vue@3.5.14(typescript@5.8.3))
'@vitejs/plugin-vue-jsx':
specifier: ^4.2.0
version: 4.2.0(vite@6.3.5(@types/node@22.15.21)(less@4.3.0))(vue@3.5.14(typescript@5.8.3))
'@vue/tsconfig':
specifier: ^0.7.0
version: 0.7.0(typescript@5.8.3)(vue@3.5.14(typescript@5.8.3))
ag-grid-community: ag-grid-community:
specifier: ^28.2.1 specifier: ^28.2.1
version: 28.2.1 version: 28.2.1
@ -23,6 +60,9 @@ importers:
axios: axios:
specifier: ^1.9.0 specifier: ^1.9.0
version: 1.9.0 version: 1.9.0
camera-controls:
specifier: 2.10.1
version: 2.10.1(three@0.176.0)
codemirror: codemirror:
specifier: ^5.65.19 specifier: ^5.65.19
version: 5.65.19 version: 5.65.19
@ -53,79 +93,27 @@ importers:
lodash: lodash:
specifier: ^4.17.21 specifier: ^4.17.21
version: 4.17.21 version: 4.17.21
pinia:
specifier: ^3.0.1
version: 3.0.2(typescript@5.8.3)(vue@3.5.14(typescript@5.8.3))
sortablejs:
specifier: 1.15.6
version: 1.15.6
split.js:
specifier: ^1.6.4
version: 1.6.5
vue:
specifier: ^3.5.13
version: 3.5.14(typescript@5.8.3)
vue-i18n:
specifier: 9.2.2
version: 9.2.2(vue@3.5.14(typescript@5.8.3))
vue-router:
specifier: ^4.5.0
version: 4.5.1(vue@3.5.14(typescript@5.8.3))
vue3-menus:
specifier: ^1.1.2
version: 1.1.2
devDependencies:
'@element-plus/icons-vue':
specifier: ^2.3.1
version: 2.3.1(vue@3.5.14(typescript@5.8.3))
'@rolldown/pluginutils':
specifier: 1.0.0-beta.8-commit.56abf23
version: 1.0.0-beta.8-commit.56abf23
'@tsconfig/node22':
specifier: ^22.0.1
version: 22.0.2
'@types/jquery':
specifier: ^3.3.31
version: 3.5.32
'@types/lodash':
specifier: ^4.17.7
version: 4.17.17
'@types/node':
specifier: ^22.14.0
version: 22.15.21
'@types/three':
specifier: ^0.176.0
version: 0.176.0
'@vicons/antd':
specifier: ^0.13.0
version: 0.13.0
'@vicons/fa':
specifier: ^0.12.0
version: 0.12.0
'@vitejs/plugin-vue':
specifier: ^5.2.3
version: 5.2.4(vite@6.3.5(@types/node@22.15.21)(less@4.3.0))(vue@3.5.14(typescript@5.8.3))
'@vitejs/plugin-vue-jsx':
specifier: ^4.2.0
version: 4.2.0(vite@6.3.5(@types/node@22.15.21)(less@4.3.0))(vue@3.5.14(typescript@5.8.3))
'@vue/tsconfig':
specifier: ^0.7.0
version: 0.7.0(typescript@5.8.3)(vue@3.5.14(typescript@5.8.3))
camera-controls:
specifier: 2.10.1
version: 2.10.1(three@0.176.0)
mitt: mitt:
specifier: ^3.0.1 specifier: ^3.0.1
version: 3.0.1 version: 3.0.1
npm-run-all2: npm-run-all2:
specifier: ^7.0.2 specifier: ^7.0.2
version: 7.0.2 version: 7.0.2
pinia:
specifier: ^3.0.1
version: 3.0.2(typescript@5.8.3)(vue@3.5.14(typescript@5.8.3))
prettier: prettier:
specifier: 3.5.3 specifier: 3.5.3
version: 3.5.3 version: 3.5.3
rimraf: rimraf:
specifier: ^6.0.1 specifier: ^6.0.1
version: 6.0.1 version: 6.0.1
sortablejs:
specifier: 1.15.6
version: 1.15.6
split.js:
specifier: ^1.6.4
version: 1.6.5
three: three:
specifier: ^0.176.0 specifier: ^0.176.0
version: 0.176.0 version: 0.176.0
@ -147,9 +135,21 @@ importers:
vite-plugin-vue-devtools: vite-plugin-vue-devtools:
specifier: ^7.7.2 specifier: ^7.7.2
version: 7.7.6(rollup@4.41.0)(vite@6.3.5(@types/node@22.15.21)(less@4.3.0))(vue@3.5.14(typescript@5.8.3)) version: 7.7.6(rollup@4.41.0)(vite@6.3.5(@types/node@22.15.21)(less@4.3.0))(vue@3.5.14(typescript@5.8.3))
vue:
specifier: ^3.5.13
version: 3.5.14(typescript@5.8.3)
vue-i18n:
specifier: 9.2.2
version: 9.2.2(vue@3.5.14(typescript@5.8.3))
vue-router:
specifier: ^4.5.0
version: 4.5.1(vue@3.5.14(typescript@5.8.3))
vue-tsc: vue-tsc:
specifier: ^2.2.8 specifier: ^2.2.8
version: 2.2.10(typescript@5.8.3) version: 2.2.10(typescript@5.8.3)
vue3-menus:
specifier: ^1.1.2
version: 1.1.2
packages: packages:
@ -558,67 +558,56 @@ packages:
resolution: {integrity: sha512-46OzWeqEVQyX3N2/QdiU/CMXYDH/lSHpgfBkuhl3igpZiaB3ZIfSjKuOnybFVBQzjsLwkus2mjaESy8H41SzvA==} resolution: {integrity: sha512-46OzWeqEVQyX3N2/QdiU/CMXYDH/lSHpgfBkuhl3igpZiaB3ZIfSjKuOnybFVBQzjsLwkus2mjaESy8H41SzvA==}
cpu: [arm] cpu: [arm]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-arm-musleabihf@4.41.0': '@rollup/rollup-linux-arm-musleabihf@4.41.0':
resolution: {integrity: sha512-lfgW3KtQP4YauqdPpcUZHPcqQXmTmH4nYU0cplNeW583CMkAGjtImw4PKli09NFi2iQgChk4e9erkwlfYem6Lg==} resolution: {integrity: sha512-lfgW3KtQP4YauqdPpcUZHPcqQXmTmH4nYU0cplNeW583CMkAGjtImw4PKli09NFi2iQgChk4e9erkwlfYem6Lg==}
cpu: [arm] cpu: [arm]
os: [linux] os: [linux]
libc: [musl]
'@rollup/rollup-linux-arm64-gnu@4.41.0': '@rollup/rollup-linux-arm64-gnu@4.41.0':
resolution: {integrity: sha512-nn8mEyzMbdEJzT7cwxgObuwviMx6kPRxzYiOl6o/o+ChQq23gfdlZcUNnt89lPhhz3BYsZ72rp0rxNqBSfqlqw==} resolution: {integrity: sha512-nn8mEyzMbdEJzT7cwxgObuwviMx6kPRxzYiOl6o/o+ChQq23gfdlZcUNnt89lPhhz3BYsZ72rp0rxNqBSfqlqw==}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-arm64-musl@4.41.0': '@rollup/rollup-linux-arm64-musl@4.41.0':
resolution: {integrity: sha512-l+QK99je2zUKGd31Gh+45c4pGDAqZSuWQiuRFCdHYC2CSiO47qUWsCcenrI6p22hvHZrDje9QjwSMAFL3iwXwQ==} resolution: {integrity: sha512-l+QK99je2zUKGd31Gh+45c4pGDAqZSuWQiuRFCdHYC2CSiO47qUWsCcenrI6p22hvHZrDje9QjwSMAFL3iwXwQ==}
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
libc: [musl]
'@rollup/rollup-linux-loongarch64-gnu@4.41.0': '@rollup/rollup-linux-loongarch64-gnu@4.41.0':
resolution: {integrity: sha512-WbnJaxPv1gPIm6S8O/Wg+wfE/OzGSXlBMbOe4ie+zMyykMOeqmgD1BhPxZQuDqwUN+0T/xOFtL2RUWBspnZj3w==} resolution: {integrity: sha512-WbnJaxPv1gPIm6S8O/Wg+wfE/OzGSXlBMbOe4ie+zMyykMOeqmgD1BhPxZQuDqwUN+0T/xOFtL2RUWBspnZj3w==}
cpu: [loong64] cpu: [loong64]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-powerpc64le-gnu@4.41.0': '@rollup/rollup-linux-powerpc64le-gnu@4.41.0':
resolution: {integrity: sha512-eRDWR5t67/b2g8Q/S8XPi0YdbKcCs4WQ8vklNnUYLaSWF+Cbv2axZsp4jni6/j7eKvMLYCYdcsv8dcU+a6QNFg==} resolution: {integrity: sha512-eRDWR5t67/b2g8Q/S8XPi0YdbKcCs4WQ8vklNnUYLaSWF+Cbv2axZsp4jni6/j7eKvMLYCYdcsv8dcU+a6QNFg==}
cpu: [ppc64] cpu: [ppc64]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-riscv64-gnu@4.41.0': '@rollup/rollup-linux-riscv64-gnu@4.41.0':
resolution: {integrity: sha512-TWrZb6GF5jsEKG7T1IHwlLMDRy2f3DPqYldmIhnA2DVqvvhY2Ai184vZGgahRrg8k9UBWoSlHv+suRfTN7Ua4A==} resolution: {integrity: sha512-TWrZb6GF5jsEKG7T1IHwlLMDRy2f3DPqYldmIhnA2DVqvvhY2Ai184vZGgahRrg8k9UBWoSlHv+suRfTN7Ua4A==}
cpu: [riscv64] cpu: [riscv64]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-riscv64-musl@4.41.0': '@rollup/rollup-linux-riscv64-musl@4.41.0':
resolution: {integrity: sha512-ieQljaZKuJpmWvd8gW87ZmSFwid6AxMDk5bhONJ57U8zT77zpZ/TPKkU9HpnnFrM4zsgr4kiGuzbIbZTGi7u9A==} resolution: {integrity: sha512-ieQljaZKuJpmWvd8gW87ZmSFwid6AxMDk5bhONJ57U8zT77zpZ/TPKkU9HpnnFrM4zsgr4kiGuzbIbZTGi7u9A==}
cpu: [riscv64] cpu: [riscv64]
os: [linux] os: [linux]
libc: [musl]
'@rollup/rollup-linux-s390x-gnu@4.41.0': '@rollup/rollup-linux-s390x-gnu@4.41.0':
resolution: {integrity: sha512-/L3pW48SxrWAlVsKCN0dGLB2bi8Nv8pr5S5ocSM+S0XCn5RCVCXqi8GVtHFsOBBCSeR+u9brV2zno5+mg3S4Aw==} resolution: {integrity: sha512-/L3pW48SxrWAlVsKCN0dGLB2bi8Nv8pr5S5ocSM+S0XCn5RCVCXqi8GVtHFsOBBCSeR+u9brV2zno5+mg3S4Aw==}
cpu: [s390x] cpu: [s390x]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-x64-gnu@4.41.0': '@rollup/rollup-linux-x64-gnu@4.41.0':
resolution: {integrity: sha512-XMLeKjyH8NsEDCRptf6LO8lJk23o9wvB+dJwcXMaH6ZQbbkHu2dbGIUindbMtRN6ux1xKi16iXWu6q9mu7gDhQ==} resolution: {integrity: sha512-XMLeKjyH8NsEDCRptf6LO8lJk23o9wvB+dJwcXMaH6ZQbbkHu2dbGIUindbMtRN6ux1xKi16iXWu6q9mu7gDhQ==}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [glibc]
'@rollup/rollup-linux-x64-musl@4.41.0': '@rollup/rollup-linux-x64-musl@4.41.0':
resolution: {integrity: sha512-m/P7LycHZTvSQeXhFmgmdqEiTqSV80zn6xHaQ1JSqwCtD1YGtwEK515Qmy9DcB2HK4dOUVypQxvhVSy06cJPEg==} resolution: {integrity: sha512-m/P7LycHZTvSQeXhFmgmdqEiTqSV80zn6xHaQ1JSqwCtD1YGtwEK515Qmy9DcB2HK4dOUVypQxvhVSy06cJPEg==}
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
libc: [musl]
'@rollup/rollup-win32-arm64-msvc@4.41.0': '@rollup/rollup-win32-arm64-msvc@4.41.0':
resolution: {integrity: sha512-4yodtcOrFHpbomJGVEqZ8fzD4kfBeCbpsUy5Pqk4RluXOdsWdjLnjhiKy2w3qzcASWd04fp52Xz7JKarVJ5BTg==} resolution: {integrity: sha512-4yodtcOrFHpbomJGVEqZ8fzD4kfBeCbpsUy5Pqk4RluXOdsWdjLnjhiKy2w3qzcASWd04fp52Xz7JKarVJ5BTg==}

BIN
src/assets/fonts/simsunb.ttf

Binary file not shown.

5
src/core/ModelUtils.ts

@ -217,7 +217,6 @@ export function quickCopyByMouse() {
if (items[0]) { if (items[0]) {
// 找到一个有效点,执行复制操作 // 找到一个有效点,执行复制操作
viewport.interactionManager.startInteraction(items[0].t, { startPoint: items[0].id }) viewport.interactionManager.startInteraction(items[0].t, { startPoint: items[0].id })
system.msg('连线成功')
return return
} }
@ -242,8 +241,8 @@ export function quickCopyByMouse() {
// return false // return false
// }) // })
if (!r || r.length === 0) { if (!items || items.length === 0) {
system.msg('鼠标所在位置,没有可复制的对象') system.msg('鼠标所在位置,没有可复制的对象', 'error')
return return
} }
} }

4
src/core/base/BaseRenderer.ts

@ -23,6 +23,10 @@ export default abstract class BaseRenderer {
this.itemTypeName = itemTypeName this.itemTypeName = itemTypeName
} }
async init(): Promise<any> {
return Promise.resolve()
}
/** /**
* *
* @param viewport * @param viewport

4
src/core/manager/InteractionManager.ts

@ -56,7 +56,7 @@ export default class InteractionManager implements IControls {
this.viewport.dragControl.dragControls.enabled = true this.viewport.dragControl.dragControls.enabled = true
this.viewport.viewerDom.style.cursor = '' this.viewport.viewerDom.style.cursor = ''
system.msg('退出新建模式') // system.msg('退出新建模式')
} }
private _setActiveInteraction(mode: string, option?: InteractionOption): void { private _setActiveInteraction(mode: string, option?: InteractionOption): void {
@ -98,7 +98,7 @@ export default class InteractionManager implements IControls {
// 更新 UI 状态 // 更新 UI 状态
this.viewport.viewerDom.style.cursor = 'crosshair' this.viewport.viewerDom.style.cursor = 'crosshair'
this.viewport.state.cursorMode = mode this.viewport.state.cursorMode = mode
system.msg(`enter [${mode}] interaction`) // system.msg(`enter [${mode}] interaction`)
} }
dispose(): void { dispose(): void {

1
src/core/manager/ModuleManager.ts

@ -28,6 +28,7 @@ export function defineModule(option: ModuleDefineOption): void {
throw new Error(`Module with name "${option.name}" is already defined.`) throw new Error(`Module with name "${option.name}" is already defined.`)
} }
modules.set(option.name, option) modules.set(option.name, option)
option.renderer.init().finally()
} }
/** /**

30
src/modules/measure/MeasureRenderer.ts

@ -7,6 +7,7 @@ import { Line2 } from 'three/examples/jsm/lines/Line2.js'
import { numberToString } from '@/utils/webutils.ts' import { numberToString } from '@/utils/webutils.ts'
import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer' import { CSS2DObject } from 'three/examples/jsm/renderers/CSS2DRenderer'
import { Text } from 'troika-three-text' import { Text } from 'troika-three-text'
import SimSunTTF from '@/assets/fonts/simsunb.ttf'
/** /**
* *
@ -24,21 +25,33 @@ export default class MeasureRenderer extends BaseRenderer {
public useHtmlLabel = false public useHtmlLabel = false
readonly pointMaterial = new THREE.MeshBasicMaterial({ color: 0x303133, transparent: true, opacity: 0.9 }) pointMaterial: THREE.MeshBasicMaterial
lineMaterial: LineMaterial
readonly lineMaterial = new LineMaterial({ readonly defaultScale: THREE.Vector3 = new THREE.Vector3(0.25, 0.1, 0.25)
readonly defaultRotation: THREE.Vector3 = new THREE.Vector3(0, 0, 0)
constructor(itemTypeName: string) {
super(itemTypeName)
}
async init() {
this.pointMaterial = new THREE.MeshBasicMaterial({ color: 0x303133, transparent: true, opacity: 0.9 })
this.lineMaterial = new LineMaterial({
color: 0xE63C17, // 主颜色 color: 0xE63C17, // 主颜色
linewidth: 2, // 实际可用的线宽 linewidth: 2, // 实际可用的线宽
vertexColors: true, // 启用顶点颜色 vertexColors: true, // 启用顶点颜色
dashed: false, dashed: false,
alphaToCoverage: true alphaToCoverage: true
}) })
return Promise.all([
super.init(),
this.loadFont()
])
}
readonly defaultScale: THREE.Vector3 = new THREE.Vector3(0.25, 0.1, 0.25) async loadFont() {
readonly defaultRotation: THREE.Vector3 = new THREE.Vector3(0, 0, 0) return Promise.resolve()
constructor(itemTypeName: string) {
super(itemTypeName)
} }
createLineBasic(start: ItemJson, end: ItemJson, type: LinkType): THREE.Object3D[] { createLineBasic(start: ItemJson, end: ItemJson, type: LinkType): THREE.Object3D[] {
@ -99,7 +112,7 @@ export default class MeasureRenderer extends BaseRenderer {
objects[0].userData.labelObj = labelObj objects[0].userData.labelObj = labelObj
} }
labelObj.position.set(position.x, position.y, position.z - 0.2) labelObj.position.set(position.x, position.y + 0.3, position.z - 0.2)
if (this.useHtmlLabel) { if (this.useHtmlLabel) {
labelObj.element.innerHTML = label labelObj.element.innerHTML = label
@ -146,6 +159,7 @@ export default class MeasureRenderer extends BaseRenderer {
} else { } else {
const label = new Text() const label = new Text()
label.text = text label.text = text
label.font = SimSunTTF
label.fontSize = 0.4 label.fontSize = 0.4
label.color = '#ff0000' label.color = '#ff0000'
label.opacity = 0.8 label.opacity = 0.8

65
src/runtime/System.ts

@ -52,40 +52,41 @@ export default class System {
/** /**
* *
* @param message * @param message
* @param type 'info'
*/ */
msg(message: string) { msg(message: string, type: 'success' | 'warning' | 'info' | 'error' = 'info'): void {
// ElMessage(cc)
console.trace(message) console.trace(message)
ElMessage({ message, type })
const $body = $('body')
// const $body = $('body')
$body.find('[xtype=tooltip]').remove() //
const $w = $( // $body.find('[xtype=tooltip]').remove()
'<div xtype="tooltip" class="yvan-msg yvan-anim yvan-anim-00">' + // const $w = $(
' <div class="yvan-msg-content">' + // '<div xtype="tooltip" class="yvan-msg yvan-anim yvan-anim-00">' +
_.escape(message) + // ' <div class="yvan-msg-content">' +
'</div></div>' // _.escape(message) +
) // '</div></div>'
$body.append($w) // )
// $body.append($w)
const iframeWidth = $w.parent().width() as number //
const iframeHeight = $w.parent().height() as number // const iframeWidth = $w.parent().width() as number
// const iframeHeight = $w.parent().height() as number
const windowWidth = $w.width() as number //
const windowHeight = $w.height() as number // const windowWidth = $w.width() as number
// const windowHeight = $w.height() as number
let setWidth = (iframeWidth - windowWidth) / 2 //
let setHeight = (iframeHeight - windowHeight) / 2 // let setWidth = (iframeWidth - windowWidth) / 2
if (iframeHeight < windowHeight || setHeight < 0) { // let setHeight = (iframeHeight - windowHeight) / 2
setHeight = 0 // if (iframeHeight < windowHeight || setHeight < 0) {
} // setHeight = 0
if (iframeWidth < windowWidth || setWidth < 0) { // }
setWidth = 0 // if (iframeWidth < windowWidth || setWidth < 0) {
} // setWidth = 0
$w.css({ left: setWidth, top: setHeight }) // }
setTimeout(() => { // $w.css({ left: setWidth, top: setHeight })
$w.remove() // setTimeout(() => {
}, 3000) // $w.remove()
// }, 3000)
} }
/** /**

Loading…
Cancel
Save