@airhang/vue-book-reader 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@airhang/vue-book-reader",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "A Vue.js book reader component with multiple flip modes, catalog, and page jump features",
5
5
  "main": "dist/vue-book-reader.common.js",
6
6
  "module": "dist/vue-book-reader.umd.js",
@@ -24,6 +24,7 @@
24
24
  "vue": "^2.6.0"
25
25
  },
26
26
  "dependencies": {
27
+ "@airhang/vue-book-reader": "^1.0.1",
27
28
  "flipbook-vue": "^1.0.0-beta.4"
28
29
  },
29
30
  "devDependencies": {
@@ -6,7 +6,6 @@
6
6
  @touchend="onContainerTouchEnd"
7
7
  @dblclick="onContainerDoubleClick"
8
8
  @click="onContentClick"
9
- :style="{ transform: `scale(${zoomScale}) translate(${translateX}px, ${translateY}px)` }"
10
9
  >
11
10
  <div class="album-header" v-if="false">
12
11
  <h1>氪氪</h1>
@@ -16,6 +15,7 @@
16
15
  <div
17
16
  v-if="contentReady"
18
17
  class="flipbook-wrapper"
18
+ :style="{ transform: `scale(${zoomScale}) translate(${translateX}px, ${translateY}px)` }"
19
19
  @dblclick="onFlipbookDoubleClick"
20
20
  @touchstart.capture="onFlipbookTouchStart"
21
21
  @touchend.capture="onFlipbookTouchEnd"
@@ -238,6 +238,12 @@
238
238
  <button @click="resetZoom" class="btn-reset-zoom">重置</button>
239
239
  </div>
240
240
  </div>
241
+
242
+ <!-- PC端缩放工具栏 -->
243
+ <div class="zoom-toolbar">
244
+ <button @click="zoomOut" class="btn-zoom" :disabled="zoomScale <= 0.5">-</button>
245
+ <button @click="zoomIn" class="btn-zoom" :disabled="zoomScale >= 3">+</button>
246
+ </div>
241
247
 
242
248
  <!-- 加载状态覆盖层 -->
243
249
  <div v-if="loading" class="loading-overlay">
@@ -816,6 +822,20 @@ export default {
816
822
  this.translateX = 0
817
823
  this.translateY = 0
818
824
  },
825
+
826
+ /**
827
+ * 放大
828
+ */
829
+ zoomIn() {
830
+ this.zoomScale = Math.min(3, this.zoomScale + 0.2)
831
+ },
832
+
833
+ /**
834
+ * 缩小
835
+ */
836
+ zoomOut() {
837
+ this.zoomScale = Math.max(0.5, this.zoomScale - 0.2)
838
+ },
819
839
 
820
840
  /**
821
841
  * PC端双击事件处理
@@ -2156,36 +2176,74 @@ export default {
2156
2176
  color: rgba(255, 255, 255, 0.9);
2157
2177
  }
2158
2178
 
2179
+ /* PC端缩放工具栏 */
2180
+ .zoom-toolbar {
2181
+ position: fixed;
2182
+ bottom: 20px;
2183
+ right: 20px;
2184
+ display: flex;
2185
+ gap: 8px;
2186
+ z-index: 10000;
2187
+ }
2188
+
2189
+ .btn-zoom {
2190
+ width: 40px;
2191
+ height: 40px;
2192
+ background: #333;
2193
+ color: white;
2194
+ border: 1px solid #666;
2195
+ border-radius: 4px;
2196
+ font-size: 1.2rem;
2197
+ cursor: pointer;
2198
+ transition: all 0.2s ease;
2199
+ display: flex;
2200
+ align-items: center;
2201
+ justify-content: center;
2202
+ }
2203
+
2204
+ .btn-zoom:hover:not(:disabled) {
2205
+ background: #555;
2206
+ }
2207
+
2208
+ .btn-zoom:disabled {
2209
+ opacity: 0.3;
2210
+ cursor: not-allowed;
2211
+ }
2212
+
2159
2213
  /* 移动端按钮优化 */
2160
2214
  @media (max-width: 768px) {
2215
+ .zoom-toolbar {
2216
+ display: none;
2217
+ }
2218
+
2161
2219
  .btn:active {
2162
2220
  background: #555;
2163
2221
  transform: none;
2164
2222
  }
2165
-
2223
+
2166
2224
  .btn:hover:not(:disabled) {
2167
2225
  background: #555;
2168
2226
  transform: none;
2169
2227
  }
2170
-
2228
+
2171
2229
  .btn-catalogue {
2172
2230
  padding: 8px 12px;
2173
2231
  font-size: 0.8rem;
2174
2232
  border-radius: 16px;
2175
2233
  }
2176
-
2234
+
2177
2235
  .btn-catalogue .drag-handle {
2178
2236
  font-size: 16px;
2179
2237
  }
2180
-
2238
+
2181
2239
  .catalogue-icon {
2182
2240
  font-size: 0.9rem;
2183
2241
  }
2184
-
2242
+
2185
2243
  .catalogue-text {
2186
2244
  font-size: 0.8rem;
2187
2245
  }
2188
-
2246
+
2189
2247
  .zoom-hint {
2190
2248
  top: 10px;
2191
2249
  right: 10px;