fix(gallery): 图幅改为显示宽度上限(单列不再拉满面板),档位 80/110/150/200 v1.6.2
This commit is contained in:
1 parent
a487fd3d44
commit
070a4818f9
3 files changed
+14
-8
No files matched your search
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@iwb-plugin/gallery",
|
||||
"private": true,
|
||||
"version": "1.6.1",
|
||||
"version": "1.6.2",
|
||||
"description": "图库:右栏图片墙(筛选/多选/预览/插入画布/下载/删除),数据由宿主 gallery 能力提供",
|
||||
"ibwPlugin": {
|
||||
"id": "gallery",
|
||||
|
||||
+10
-6
@@ -8,8 +8,9 @@
|
||||
if (!global.IWBPluginHost) return
|
||||
|
||||
var PANEL_ID = 'gallery-panel'
|
||||
var DEF = { insertK: '1k', tile: 130, range: '' }
|
||||
var TILES = [[110, '小'], [130, '中'], [170, '大'], [220, '特大']]
|
||||
var DEF = { insertK: '1k', tile: 110, range: '' }
|
||||
// v1.6.2:图幅=**实际显示宽度上限**(此前只当「算列数」用,独列时会被拉到撑满面板,选「小」也很大)
|
||||
var TILES = [[80, '小'], [110, '中'], [150, '大'], [200, '特大']]
|
||||
var KS = [['orig', '原图'], ['2k', '2K'], ['1k', '1K'], ['0.5k', '0.5K']]
|
||||
var RANGES = [['', '全部'], ['today', '今天'], ['7d', '7 天'], ['30d', '30 天']]
|
||||
|
||||
@@ -296,7 +297,10 @@
|
||||
function renderGrid () {
|
||||
clear(grid)
|
||||
var gap = 6
|
||||
var n = Math.max(1, Math.floor((gridW + gap) / (Number(cfg.tile) + gap)))
|
||||
var tileW = Math.max(40, Number(cfg.tile) || 110)
|
||||
var n = Math.max(1, Math.floor((gridW + gap) / (tileW + gap)))
|
||||
// 列宽 = min(图幅, 均分宽度):图幅是「显示宽度上限」,不再把单列拉满面板
|
||||
var colW = Math.min(tileW, (gridW - gap * (n - 1)) / n)
|
||||
var cols = []
|
||||
var heights = []
|
||||
for (var c = 0; c < n; c++) { cols.push([]); heights.push(0) }
|
||||
@@ -306,10 +310,10 @@
|
||||
var min = 0
|
||||
for (var j = 1; j < n; j++) if (heights[j] < heights[min]) min = j
|
||||
cols[min].push(it)
|
||||
heights[min] += ((gridW - gap * (n - 1)) / n) * ratio + gap
|
||||
heights[min] += colW * ratio + gap
|
||||
}
|
||||
for (var ci = 0; ci < cols.length; ci++) {
|
||||
var col = el('div', { class: 'iwb-history-col' })
|
||||
var col = el('div', { class: 'iwb-history-col', style: 'width:' + Math.round(colW) + 'px;flex:0 0 auto' })
|
||||
for (var k = 0; k < cols[ci].length; k++) col.appendChild(itemNode(cols[ci][k]))
|
||||
grid.appendChild(col)
|
||||
}
|
||||
@@ -483,7 +487,7 @@
|
||||
global.IWBPluginHost.register({
|
||||
id: 'gallery',
|
||||
name: '图库',
|
||||
version: '1.6.1',
|
||||
version: '1.6.2',
|
||||
apiVersion: 1,
|
||||
capabilities: ['panels', 'gallery'],
|
||||
data: { schemaVersion: 1, maxBytes: 65536 },
|
||||
|
||||
+3
-1
@@ -6,7 +6,9 @@
|
||||
|
||||
/* ---- 面板留白:边缘收小,避免窄栏里浪费空间 ---- */
|
||||
.iwb-history-embedded { padding: 8px 8px 6px; gap: 6px; }
|
||||
.iwb-history-embedded .iwb-history-grid { gap: 6px; padding: 0 0 4px; }
|
||||
.iwb-history-embedded .iwb-history-grid { gap: 6px; padding: 0 0 4px; justify-content: center; }
|
||||
/* 列宽由插件按「图幅」写死(style width),这里禁用宿主的 flex:1 拉伸 */
|
||||
.iwb-history-embedded .iwb-history-col { flex: 0 0 auto; gap: 6px; }
|
||||
|
||||
/* ---- 顶栏 ---- */
|
||||
.iwb-gal-head { display: flex; align-items: center; gap: 6px; min-height: 0; }
|
||||
|
||||
Reference in new issue
Block a user