liutian 1 vuosi sitten
vanhempi
commit
265b596bd2

+ 0 - 3
packages/core/src/annotation/paint/text.js

@@ -103,9 +103,6 @@ export default class Text {
       const rect = this.getTextRect()
       
       let color = this.color
-      if (typeof color === 'string' && color.startsWith("#")) {
-        color = hexToRgb(color)
-      }
 
       const text = getHtmlToText(textEditorElement)
       const annotation = {

+ 11 - 3
packages/core/src/worker/compdfkit_worker.js

@@ -234,6 +234,11 @@ class CPDFWorker {
       if (annotation.backgroundColor && annotation.operate === 'mod-form') {
         setWidgetBackgroundColor(annotation)
       }
+      if (annotation.title && annotation.operate === 'mod-form') {
+        const { annotPtr, title: rawTitle } = annotation
+        const title = stringToNewUTF8(rawTitle)
+        Module._SetButtonTitle(annotPtr, title)
+      }
       if (annotation.fieldName) {
         setWidgetFieldName(annotation)
       }
@@ -797,6 +802,9 @@ function getAnnotation({
   const createDate = parseAdobePDFTimestamp(UTF8ToString(rawCreateDate))
   const rawContent = Module._GetAnnotContent(annotPtr)
   const content = UTF8ToString(rawContent)
+  const rawTitle = Module._GetAnnotTitle(annotPtr)
+  const title = UTF8ToString(rawTitle)
+  console.log(title)
 
   const transparency = roundToDecimalPlaces(Module._GetAnnotTransparency(annotPtr))
 
@@ -1307,10 +1315,10 @@ function setAnnotContent(data) {
 }
 
 function setAnnotRGBColor(data) {
-  const { annotPtr, color } = data
-  const { R = 255, G = 255, B = 255 } = color
+  const { annotPtr, color:rawColor } = data
+  const color = convertColorToCppFormat(rawColor)
 
-  const isSetColorSuccess = Module._SetAnnotRGBColor(annotPtr, R / 255, G / 255, B / 255)
+  const isSetColorSuccess = Module._SetAnnotRGBColor(annotPtr, color.R, color.G, color.B)
   return !!isSetColorSuccess
 }
 

+ 2 - 1
packages/webview/locales/en.json

@@ -45,7 +45,8 @@
     "viewSetting": "View Setting",
     "download": "Download",
     "flatten" : "Save as Flattened PDF",
-    "print" : "Print"
+    "print" : "Print",
+    "language": "Language"
   },
 
   "nextPage": "Next",

+ 2 - 1
packages/webview/locales/zh-CN.json

@@ -46,7 +46,8 @@
     "viewSetting": "页面显示",
     "download": "下载",
     "flatten" : "展平后下载",
-    "print" : "打印"
+    "print" : "打印",
+    "language": "语言"
   },
 
   "nextPage": "下一页",

+ 52 - 0
packages/webview/src/components/Dialogs/ChangeLanguage.vue

@@ -0,0 +1,52 @@
+<template>
+  <div v-show="isModalVisible" class="language-setting-popup">
+    <div class="wrapper">
+      <div className="header-container">
+        <span class="title">{{title}}</span>
+        <Button className="close-button" :onClick="handleClose"><CloseModal /></Button>
+      </div>
+      <div class="content">
+        <div class="title">Language</div>
+        <div class="item" @click="selectLanguage">
+          <Circled v-if="$i18n.locale === 'en' || selectedLanguage" />
+          <Circle v-else />
+          English
+        </div>
+        <div class="item" @click="selectLanguage">
+          <Circled v-if="$i18n.locale === 'zh-CN' || selectedLanguage" />
+          <Circle v-else />
+          简体中文
+        </div>
+        <span class="set-btn" @click="handleLanguage">{{ $t('') }}</span>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script setup>
+  import { computed, ref } from 'vue'
+
+  const selectedLanguage = ref('')
+  const isModalVisible = computed(() => useViewer.isElementOpen('changeLanguageDialog'))
+  
+  const handleClose = () => {
+    useViewer.closeElement('changeLanguageDialog')
+    selectedLanguage.value = ''
+  }
+
+  const selectLanguage = (language) => {
+    selectedLanguage.value = language
+  }
+
+  const handleLanguage = () => {
+    handleClose()
+  }
+</script>
+
+<style lang="scss">
+  .language-setting-popup {
+    background-color: var(--c-header-bg);
+    box-shadow: 0px 4px 32px 0px rgba(129, 149, 200, 0.32);
+    border-radius: 4px;
+  }
+</style>

+ 10 - 0
packages/webview/src/components/Dropdown/Dropdown.vue

@@ -18,6 +18,12 @@
       <div class="drop-item" @click="downloadFile"><DownloadButton />{{ $t('header.download') }}</div>
       <div class="drop-item" @click="handleFlatten"><FlattenButton />{{ $t('header.flatten') }}</div>
       <div class="drop-item" @click="handlePrint"><PrintButton />{{ $t('header.print') }}</div>
+      <div class="drop-item" @click="handleLanguage">
+        <Button :title="$t('header.language')">
+          <Language />
+        </Button>
+        {{ $t('header.language') }}
+      </div>
     </div>
   </n-popover>
 </template>
@@ -84,4 +90,8 @@
       console.log(error)
     }
   }
+
+  const handleLanguage = () => {
+    useViewer.openElement('changeLanguageDialog')
+  }
 </script>

+ 5 - 0
packages/webview/src/components/Icon/Circle.vue

@@ -0,0 +1,5 @@
+<template>
+  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+    <circle cx="8" cy="8" r="6.5" fill="white" stroke="#666666"/>
+  </svg>
+</template>

+ 6 - 0
packages/webview/src/components/Icon/Circled.vue

@@ -0,0 +1,6 @@
+<template>
+  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
+    <circle cx="8" cy="8" r="7" fill="#1460F3"/>
+    <circle cx="8" cy="8" r="3" fill="white"/>
+  </svg>
+</template>

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 5 - 0
packages/webview/src/components/Icon/Language.vue


+ 2 - 2
packages/webview/src/components/RightPanel/RightPanel.vue

@@ -309,8 +309,8 @@
     useDocument.setPropertyPanel({'multiline': newValue})
   })
   
-  watch(() => property.project, (newValue, oldValue) => {
-    useDocument.setPropertyPanel({'project': newValue})
+  watch(() => property.title, (newValue, oldValue) => {
+    useDocument.setPropertyPanel({'title': newValue})
   })
   
   watch(() => property.projectList, (newValue, oldValue) => {

+ 2 - 0
packages/webview/src/stores/modules/viewer.js

@@ -26,6 +26,7 @@ export const useViewerStore = defineStore({
       stampPanel: false,
       linkPanel: false,
       compareSettingDialog: false,
+      changeLanguageDialog: false,
       setPasswordModal: false,
       signCreatePanel: false,
       downloadSettingDialog: false,
@@ -332,6 +333,7 @@ export const useViewerStore = defineStore({
         stampPanel: false,
         linkPanel: false,
         compareSettingDialog: false,
+        changeLanguageDialog: false,
         setPasswordModal: false,
         signCreatePanel: false,
         downloadSettingDialog: false,