From ec1e5e16cd78bdf316dc1b1aac8a8aaf119f86eb Mon Sep 17 00:00:00 2001 From: peerless_hero Date: Thu, 17 Aug 2023 21:28:49 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=A6=96=E6=AC=A1=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 7 + .hbuilderx/launch.json | 40 + .npmrc | 1 + App.vue | 73 + common/fui-app.css | 174 + common/fui-app.js | 57 + common/fui-request.js | 30 + .../fui-actionsheet/fui-actionsheet.vue | 437 +++ components/firstui/fui-alert/fui-alert.vue | 244 ++ .../firstui/fui-animation/fui-animation.vue | 218 ++ .../firstui/fui-autograph/fui-autograph.vue | 351 ++ .../gcanvas/bridge/bridge-weex.js | 242 ++ .../context-2d/FillStyleLinearGradient.js | 19 + .../gcanvas/context-2d/FillStylePattern.js | 9 + .../context-2d/FillStyleRadialGradient.js | 18 + .../gcanvas/context-2d/RenderingContext.js | 667 ++++ .../gcanvas/context-webgl/ActiveInfo.js | 12 + .../gcanvas/context-webgl/Buffer.js | 22 + .../gcanvas/context-webgl/Framebuffer.js | 22 + .../gcanvas/context-webgl/GLenum.js | 299 ++ .../gcanvas/context-webgl/GLmethod.js | 143 + .../gcanvas/context-webgl/GLtype.js | 23 + .../gcanvas/context-webgl/Program.js | 22 + .../gcanvas/context-webgl/Renderbuffer.js | 22 + .../gcanvas/context-webgl/RenderingContext.js | 1192 ++++++ .../gcanvas/context-webgl/Shader.js | 23 + .../context-webgl/ShaderPrecisionFormat.js | 12 + .../gcanvas/context-webgl/Texture.js | 23 + .../gcanvas/context-webgl/UniformLocation.js | 23 + .../gcanvas/context-webgl/classUtils.js | 4 + .../fui-autograph/gcanvas/env/canvas.js | 75 + .../fui-autograph/gcanvas/env/image.js | 97 + .../firstui/fui-autograph/gcanvas/env/tool.js | 25 + .../firstui/fui-autograph/gcanvas/index.js | 48 + components/firstui/fui-avatar/fui-avatar.vue | 242 ++ .../firstui/fui-backdrop/fui-backdrop.vue | 179 + .../firstui/fui-backtop/fui-backtop.vue | 132 + components/firstui/fui-badge/fui-badge.vue | 234 ++ .../firstui/fui-banner-arc/fui-banner-arc.vue | 156 + components/firstui/fui-barcode/barcode.js | 205 ++ .../firstui/fui-barcode/fui-barcode.vue | 142 + .../fui-barcode/gcanvas/bridge/bridge-weex.js | 242 ++ .../context-2d/FillStyleLinearGradient.js | 19 + .../gcanvas/context-2d/FillStylePattern.js | 9 + .../context-2d/FillStyleRadialGradient.js | 18 + .../gcanvas/context-2d/RenderingContext.js | 667 ++++ .../gcanvas/context-webgl/ActiveInfo.js | 12 + .../gcanvas/context-webgl/Buffer.js | 22 + .../gcanvas/context-webgl/Framebuffer.js | 22 + .../gcanvas/context-webgl/GLenum.js | 299 ++ .../gcanvas/context-webgl/GLmethod.js | 143 + .../gcanvas/context-webgl/GLtype.js | 23 + .../gcanvas/context-webgl/Program.js | 22 + .../gcanvas/context-webgl/Renderbuffer.js | 22 + .../gcanvas/context-webgl/RenderingContext.js | 1192 ++++++ .../gcanvas/context-webgl/Shader.js | 23 + .../context-webgl/ShaderPrecisionFormat.js | 12 + .../gcanvas/context-webgl/Texture.js | 23 + .../gcanvas/context-webgl/UniformLocation.js | 23 + .../gcanvas/context-webgl/classUtils.js | 4 + .../firstui/fui-barcode/gcanvas/env/canvas.js | 75 + .../firstui/fui-barcode/gcanvas/env/image.js | 97 + .../firstui/fui-barcode/gcanvas/env/tool.js | 25 + .../firstui/fui-barcode/gcanvas/index.js | 48 + .../fui-bottom-navbar/fui-bottom-navbar.vue | 276 ++ .../fui-bottom-popup/fui-bottom-popup.vue | 252 ++ .../firstui/fui-bubble-box/fui-bubble-box.vue | 520 +++ components/firstui/fui-button/fui-button.vue | 525 +++ .../firstui/fui-calendar/fui-calendar.vue | 906 +++++ components/firstui/fui-calendar/index.js | 580 +++ components/firstui/fui-card/fui-card.vue | 326 ++ .../firstui/fui-cascader/fui-cascader.vue | 588 +++ .../fui-checkbox-group/fui-checkbox-group.vue | 102 + .../firstui/fui-checkbox/fui-checkbox.vue | 241 ++ components/firstui/fui-circle/fui-circle.vue | 339 ++ .../fui-circle/gcanvas/bridge/bridge-weex.js | 242 ++ .../context-2d/FillStyleLinearGradient.js | 19 + .../gcanvas/context-2d/FillStylePattern.js | 9 + .../context-2d/FillStyleRadialGradient.js | 18 + .../gcanvas/context-2d/RenderingContext.js | 667 ++++ .../gcanvas/context-webgl/ActiveInfo.js | 12 + .../gcanvas/context-webgl/Buffer.js | 22 + .../gcanvas/context-webgl/Framebuffer.js | 22 + .../gcanvas/context-webgl/GLenum.js | 299 ++ .../gcanvas/context-webgl/GLmethod.js | 143 + .../gcanvas/context-webgl/GLtype.js | 23 + .../gcanvas/context-webgl/Program.js | 22 + .../gcanvas/context-webgl/Renderbuffer.js | 22 + .../gcanvas/context-webgl/RenderingContext.js | 1192 ++++++ .../gcanvas/context-webgl/Shader.js | 23 + .../context-webgl/ShaderPrecisionFormat.js | 12 + .../gcanvas/context-webgl/Texture.js | 23 + .../gcanvas/context-webgl/UniformLocation.js | 23 + .../gcanvas/context-webgl/classUtils.js | 4 + .../firstui/fui-circle/gcanvas/env/canvas.js | 75 + .../firstui/fui-circle/gcanvas/env/image.js | 97 + .../firstui/fui-circle/gcanvas/env/tool.js | 25 + .../firstui/fui-circle/gcanvas/index.js | 48 + components/firstui/fui-circle/mpjs.js | 142 + components/firstui/fui-circle/nvue.js | 142 + components/firstui/fui-circle/render.js | 31 + .../firstui/fui-clipboard/clipboard.min.js | 8 + components/firstui/fui-clipboard/index.js | 52 + components/firstui/fui-col/fui-col.vue | 3220 +++++++++++++++++ .../fui-collapse-item/fui-collapse-item.vue | 351 ++ .../firstui/fui-collapse/fui-collapse.vue | 50 + components/firstui/fui-config/index.js | 115 + .../firstui/fui-copy-text/fui-copy-text.vue | 465 +++ .../fui-copy-text/lib/clipboard.min.js | 8 + components/firstui/fui-copy-text/lib/index.js | 52 + .../firstui/fui-count-down/fui-count-down.vue | 376 ++ .../fui-countdown-verify.vue | 264 ++ .../fui-cubic-bezier/fui-cubic-bezier.vue | 225 ++ .../firstui/fui-data-tag/fui-data-tag.vue | 436 +++ .../fui-date-picker/fui-date-picker.vue | 1445 ++++++++ components/firstui/fui-dialog/fui-dialog.vue | 306 ++ .../fui-digital-keyboard.vue | 497 +++ .../fui-digital-roller/fui-digital-roller.vue | 188 + .../firstui/fui-divider/fui-divider.vue | 112 + components/firstui/fui-drag/bindingx.js | 201 + components/firstui/fui-drag/f-drag-item.vue | 209 ++ components/firstui/fui-drag/fui-drag.vue | 373 ++ components/firstui/fui-drag/index.wxs | 290 ++ components/firstui/fui-drag/mpjs.js | 145 + components/firstui/fui-drawer/fui-drawer.vue | 250 ++ .../fui-dropdown-list/fui-dropdown-list.vue | 468 +++ .../fui-dropdown-menu/fui-dropdown-menu.vue | 562 +++ components/firstui/fui-empty/fui-empty.vue | 131 + components/firstui/fui-fab/bindingx.js | 83 + components/firstui/fui-fab/fui-fab.vue | 607 ++++ components/firstui/fui-fab/index.wxs | 120 + components/firstui/fui-fab/mpjs.js | 59 + .../firstui/fui-filter-bar/fui-filter-bar.vue | 230 ++ components/firstui/fui-footer/fui-footer.vue | 221 ++ .../firstui/fui-form-field/fui-form-field.vue | 37 + .../firstui/fui-form-item/fui-form-item.vue | 314 ++ components/firstui/fui-form/fui-form.vue | 253 ++ components/firstui/fui-form/fui-validator.js | 335 ++ .../firstui/fui-gallery/fui-gallery.vue | 276 ++ .../firstui/fui-grid-item/fui-grid-item.vue | 182 + components/firstui/fui-grid/fui-grid.vue | 269 ++ .../firstui/fui-horizontal-scroll/bindingx.js | 42 + .../fui-horizontal-scroll.vue | 271 ++ .../firstui/fui-horizontal-scroll/index.wxs | 39 + .../firstui/fui-horizontal-scroll/mpjs.js | 32 + components/firstui/fui-icon/fui-icon.js | 166 + components/firstui/fui-icon/fui-icon.ttf | Bin 0 -> 39840 bytes components/firstui/fui-icon/fui-icon.vue | 148 + .../firstui/fui-image-cropper/bindingx.js | 282 ++ .../fui-image-cropper/fui-image-cropper.vue | 677 ++++ .../firstui/fui-image-cropper/index.wxs | 342 ++ components/firstui/fui-image-cropper/mpjs.js | 231 ++ .../fui-index-list/f-index-list-item.vue | 256 ++ .../firstui/fui-index-list/fui-index-list.vue | 649 ++++ .../fui-input-number/fui-input-number.vue | 326 ++ components/firstui/fui-input/fui-input.vue | 716 ++++ components/firstui/fui-label/fui-label.vue | 72 + .../firstui/fui-landscape/fui-landscape.vue | 246 ++ .../firstui/fui-lazyload/fui-lazyload.vue | 232 ++ .../fui-license-plate/fui-license-plate.js | 128 + .../fui-license-plate/fui-license-plate.vue | 448 +++ components/firstui/fui-link/fui-link.vue | 148 + .../firstui/fui-list-cell/fui-list-cell.vue | 247 ++ components/firstui/fui-list/fui-list.vue | 195 + .../firstui/fui-load-ani/fui-load-ani.vue | 524 +++ .../firstui/fui-loading/fui-loading.vue | 245 ++ .../firstui/fui-loadmore/fui-loadmore.vue | 247 ++ .../firstui/fui-lottie/fui-lottie-app.js | 10 + .../firstui/fui-lottie/fui-lottie-mp.js | 13 + components/firstui/fui-lottie/fui-lottie.vue | 229 ++ .../firstui/fui-message/fui-message.vue | 220 ++ components/firstui/fui-modal/fui-modal.vue | 408 +++ .../firstui/fui-movable-view/bindingx.js | 103 + .../fui-movable-view/fui-movable-view.vue | 192 + components/firstui/fui-movable-view/index.wxs | 139 + components/firstui/fui-movable-view/mpjs.js | 76 + .../firstui/fui-nav-bar/fui-nav-bar.vue | 291 ++ .../firstui/fui-notice-bar/fui-notice-bar.vue | 405 +++ .../fui-overflow-hidden.vue | 157 + .../firstui/fui-pagination/fui-pagination.vue | 416 +++ components/firstui/fui-panel/fui-panel.vue | 537 +++ components/firstui/fui-picker/fui-picker.vue | 1059 ++++++ .../fui-poster-weex/fui-poster-weex.vue | 648 ++++ .../gcanvas/bridge/bridge-weex.js | 242 ++ .../context-2d/FillStyleLinearGradient.js | 19 + .../gcanvas/context-2d/FillStylePattern.js | 9 + .../context-2d/FillStyleRadialGradient.js | 18 + .../gcanvas/context-2d/RenderingContext.js | 667 ++++ .../gcanvas/context-webgl/ActiveInfo.js | 12 + .../gcanvas/context-webgl/Buffer.js | 22 + .../gcanvas/context-webgl/Framebuffer.js | 22 + .../gcanvas/context-webgl/GLenum.js | 299 ++ .../gcanvas/context-webgl/GLmethod.js | 143 + .../gcanvas/context-webgl/GLtype.js | 23 + .../gcanvas/context-webgl/Program.js | 22 + .../gcanvas/context-webgl/Renderbuffer.js | 22 + .../gcanvas/context-webgl/RenderingContext.js | 1192 ++++++ .../gcanvas/context-webgl/Shader.js | 23 + .../context-webgl/ShaderPrecisionFormat.js | 12 + .../gcanvas/context-webgl/Texture.js | 23 + .../gcanvas/context-webgl/UniformLocation.js | 23 + .../gcanvas/context-webgl/classUtils.js | 4 + .../fui-poster-weex/gcanvas/env/canvas.js | 75 + .../fui-poster-weex/gcanvas/env/image.js | 97 + .../fui-poster-weex/gcanvas/env/tool.js | 25 + .../firstui/fui-poster-weex/gcanvas/index.js | 48 + components/firstui/fui-poster/fui-poster.vue | 206 ++ components/firstui/fui-poster/index.js | 644 ++++ .../firstui/fui-preview/fui-preview.vue | 552 +++ .../firstui/fui-progress/fui-progress.vue | 218 ++ .../fui-puzzle-verify/fui-puzzle-verify.vue | 426 +++ .../firstui/fui-puzzle-verify/index.wxs | 147 + components/firstui/fui-puzzle-verify/mpjs.js | 68 + components/firstui/fui-puzzle-verify/weex.js | 115 + components/firstui/fui-qrcode/fui-qr/index.js | 17 + .../firstui/fui-qrcode/fui-qr/lib/8BitByte.js | 23 + .../fui-qrcode/fui-qr/lib/BitBuffer.js | 39 + .../fui-qr/lib/ErrorCorrectLevel.js | 7 + .../fui-qrcode/fui-qr/lib/LICENSE-qrcode | 7 + .../fui-qrcode/fui-qr/lib/Polynomial.js | 68 + .../firstui/fui-qrcode/fui-qr/lib/QRCode.js | 438 +++ .../firstui/fui-qrcode/fui-qr/lib/RSBlock.js | 300 ++ .../firstui/fui-qrcode/fui-qr/lib/math.js | 45 + .../firstui/fui-qrcode/fui-qr/lib/mode.js | 7 + .../firstui/fui-qrcode/fui-qr/lib/util.js | 280 ++ components/firstui/fui-qrcode/fui-qrcode.vue | 186 + .../fui-qrcode/gcanvas/bridge/bridge-weex.js | 242 ++ .../context-2d/FillStyleLinearGradient.js | 19 + .../gcanvas/context-2d/FillStylePattern.js | 9 + .../context-2d/FillStyleRadialGradient.js | 18 + .../gcanvas/context-2d/RenderingContext.js | 667 ++++ .../gcanvas/context-webgl/ActiveInfo.js | 12 + .../gcanvas/context-webgl/Buffer.js | 22 + .../gcanvas/context-webgl/Framebuffer.js | 22 + .../gcanvas/context-webgl/GLenum.js | 299 ++ .../gcanvas/context-webgl/GLmethod.js | 143 + .../gcanvas/context-webgl/GLtype.js | 23 + .../gcanvas/context-webgl/Program.js | 22 + .../gcanvas/context-webgl/Renderbuffer.js | 22 + .../gcanvas/context-webgl/RenderingContext.js | 1192 ++++++ .../gcanvas/context-webgl/Shader.js | 23 + .../context-webgl/ShaderPrecisionFormat.js | 12 + .../gcanvas/context-webgl/Texture.js | 23 + .../gcanvas/context-webgl/UniformLocation.js | 23 + .../gcanvas/context-webgl/classUtils.js | 4 + .../firstui/fui-qrcode/gcanvas/env/canvas.js | 75 + .../firstui/fui-qrcode/gcanvas/env/image.js | 97 + .../firstui/fui-qrcode/gcanvas/env/tool.js | 25 + .../firstui/fui-qrcode/gcanvas/index.js | 48 + .../fui-radio-group/fui-radio-group.vue | 97 + components/firstui/fui-radio/fui-radio.vue | 235 ++ components/firstui/fui-rate/fui-rate.vue | 330 ++ components/firstui/fui-request/fui-common.js | 120 + .../firstui/fui-request/fui-taskStore.js | 57 + components/firstui/fui-request/index.js | 179 + components/firstui/fui-result/fui-result.vue | 280 ++ .../fui-rotate-verify/fui-rotate-verify.vue | 411 +++ .../firstui/fui-rotate-verify/index.wxs | 137 + components/firstui/fui-rotate-verify/mpjs.js | 62 + components/firstui/fui-rotate-verify/weex.js | 111 + components/firstui/fui-row/fui-row.vue | 166 + .../firstui/fui-safe-area/fui-safe-area.vue | 72 + .../firstui/fui-search-bar/fui-search-bar.vue | 562 +++ .../firstui/fui-section/fui-section.vue | 205 ++ .../fui-segmented-control.vue | 222 ++ components/firstui/fui-select/fui-select.vue | 783 ++++ .../fui-share-sheet/fui-share-sheet.vue | 594 +++ .../fui-single-input/fui-single-input.vue | 544 +++ .../firstui/fui-skeleton/fui-skeleton.vue | 211 ++ .../fui-slide-verify/fui-slide-verify.vue | 382 ++ components/firstui/fui-slide-verify/index.wxs | 149 + components/firstui/fui-slide-verify/mpjs.js | 66 + components/firstui/fui-slide-verify/weex.js | 89 + .../fui-slider-captcha/fui-slider-captcha.vue | 724 ++++ .../firstui/fui-slider-captcha/index.wxs | 168 + components/firstui/fui-slider-captcha/mpjs.js | 82 + components/firstui/fui-slider-captcha/weex.js | 131 + components/firstui/fui-slider/bindingx.js | 212 ++ components/firstui/fui-slider/fui-slider.vue | 398 ++ components/firstui/fui-slider/index.wxs | 290 ++ components/firstui/fui-slider/mpjs.js | 170 + components/firstui/fui-spin/fui-spin.vue | 119 + .../firstui/fui-status-bar/fui-status-bar.vue | 59 + components/firstui/fui-steps/fui-steps.vue | 484 +++ components/firstui/fui-sticky/fui-sticky.vue | 190 + .../firstui/fui-swipe-action/bindingx.js | 226 ++ .../fui-swipe-action/fui-swipe-action.vue | 234 ++ components/firstui/fui-swipe-action/index.wxs | 244 ++ components/firstui/fui-swipe-action/mpjs.js | 195 + components/firstui/fui-swipe-action/mpwxs.js | 107 + .../fui-swipeaction-group.vue | 57 + .../firstui/fui-swiper-dot/fui-swiper-dot.vue | 188 + components/firstui/fui-switch/fui-switch.vue | 304 ++ components/firstui/fui-tabbar/fui-tabbar.vue | 391 ++ components/firstui/fui-table/fui-table.vue | 793 ++++ components/firstui/fui-tabs/fui-tabs.vue | 542 +++ components/firstui/fui-tag/fui-tag.vue | 368 ++ components/firstui/fui-text/fui-text.vue | 286 ++ .../firstui/fui-textarea/fui-textarea.vue | 634 ++++ components/firstui/fui-theme/fui-theme.css | 85 + .../fui-timeaxis-node/fui-timeaxis-node.vue | 109 + .../firstui/fui-timeaxis/fui-timeaxis.vue | 80 + components/firstui/fui-timer/fui-timer.vue | 375 ++ components/firstui/fui-toast/fui-toast.vue | 207 ++ .../firstui/fui-top-popup/fui-top-popup.vue | 186 + .../fui-upload-video/fui-upload-video.vue | 572 +++ components/firstui/fui-upload/fui-upload.vue | 603 +++ components/firstui/fui-utils/index.js | 374 ++ .../firstui/fui-validator/fui-validator.js | 335 ++ .../fui-vtabs-content/fui-vtabs-content.vue | 96 + components/firstui/fui-vtabs/fui-vtabs.vue | 526 +++ .../fui-waterfall-item/fui-waterfall-item.vue | 236 ++ .../firstui/fui-waterfall/fui-waterfall.vue | 167 + favicon.ico | Bin 0 -> 4286 bytes index.html | 14 + libs/qqmap-wx-jssdk.min.js | 2 + main.js | 78 + manifest.json | 130 + package.json | 31 + pages.json | 2240 ++++++++++++ pages/common/coding/coding.vue | 74 + .../component/basics/animation/animation.vue | 79 + pages/component/basics/button/button.vue | 60 + pages/component/basics/color/color.js | 118 + pages/component/basics/color/color.vue | 72 + pages/component/basics/footer/footer.vue | 42 + pages/component/basics/icon/icon.js | 168 + pages/component/basics/icon/icon.vue | 87 + pages/component/basics/text/text.vue | 55 + .../component/canvas/autograph/autograph.vue | 111 + pages/component/canvas/barcode/barcode.vue | 75 + pages/component/canvas/poster/poster.vue | 434 +++ pages/component/canvas/qrcode/qrcode.vue | 62 + pages/component/data/alert/alert.vue | 79 + pages/component/data/avatar/avatar.vue | 60 + pages/component/data/badge/badge.vue | 118 + pages/component/data/circle/circle.vue | 47 + pages/component/data/collapse/collapse.vue | 159 + pages/component/data/countdown/countdown.vue | 129 + pages/component/data/dataTag/dataTag.vue | 117 + pages/component/data/divider/divider.vue | 49 + pages/component/data/empty/empty.vue | 44 + pages/component/data/loadmore/loadmore.vue | 43 + pages/component/data/progress/progress.vue | 64 + pages/component/data/skeleton/skeleton.vue | 115 + pages/component/data/tag/tag.vue | 94 + pages/component/expand/backtop/backtop.vue | 71 + pages/component/expand/copyText/copyText.vue | 73 + .../countdownVerify/countdownVerify.vue | 87 + .../expand/cubicBezier/cubicBezier.vue | 182 + .../digitalKeyboard/digitalKeyboard.vue | 243 ++ .../expand/digitalRoller/digitalRoller.vue | 73 + .../expand/drag-custom/drag-custom.vue | 108 + pages/component/expand/drag-img/drag-img.vue | 76 + .../component/expand/drag-text/drag-text.vue | 77 + pages/component/expand/drag/drag.vue | 53 + .../component/expand/filterBar/filterBar.vue | 331 ++ .../expand/imageCropper/imageCropper.vue | 126 + pages/component/expand/lazyload/lazyload.vue | 59 + .../expand/licensePlate/licensePlate.vue | 127 + .../expand/overflowHidden/overflowHidden.vue | 114 + .../expand/puzzleVerify/puzzleVerify.vue | 123 + .../component/expand/result-eg/result-eg.vue | 50 + pages/component/expand/result/result.vue | 53 + .../expand/rotateVerify/rotateVerify.vue | 110 + pages/component/expand/safeArea/safeArea.vue | 73 + .../expand/shareSheet/shareSheet.vue | 180 + .../expand/singleInput-A/singleInput-A.vue | 44 + .../expand/singleInput-B/singleInput-B.vue | 46 + .../expand/singleInput/singleInput.vue | 51 + .../expand/slideVerify/slideVerify.vue | 59 + .../expand/sliderCaptcha/sliderCaptcha.vue | 84 + .../component/expand/swiperDot/swiperDot.vue | 173 + pages/component/expand/table/table.vue | 157 + pages/component/expand/table/tableData.js | 161 + pages/component/expand/timer/timer.vue | 110 + .../component/expand/waterfall/waterfall.vue | 65 + pages/component/form/calendar/calendar.vue | 166 + pages/component/form/cascader/cascader.vue | 164 + pages/component/form/cascader/data.js | 301 ++ pages/component/form/checkbox/checkbox.vue | 141 + .../component/form/datePicker/datePicker.vue | 95 + pages/component/form/form/form.vue | 358 ++ pages/component/form/formItem/formItem.vue | 164 + pages/component/form/input/input.vue | 99 + .../form/inputNumber/inputNumber.vue | 59 + pages/component/form/label/label.vue | 119 + pages/component/form/picker/picker.js | 276 ++ pages/component/form/picker/picker.vue | 157 + pages/component/form/radio/radio.vue | 141 + pages/component/form/rate/rate.vue | 53 + pages/component/form/searchBar/searchBar.vue | 83 + pages/component/form/select/select.vue | 129 + pages/component/form/slider/slider.vue | 85 + pages/component/form/switch/switch.vue | 83 + pages/component/form/textarea/textarea.vue | 63 + pages/component/form/upload/upload.vue | 225 ++ .../form/uploadVideo/uploadVideo.vue | 211 ++ pages/component/js/clipboard/clipboard.vue | 64 + pages/component/js/request/request.vue | 167 + pages/component/js/utils/utils.vue | 149 + pages/component/js/validator/validator.vue | 127 + pages/component/layout/arc/arc.vue | 59 + pages/component/layout/card/card.vue | 103 + pages/component/layout/grid/grid.vue | 95 + .../horizontal-scroll/horizontal-scroll.vue | 80 + .../layout/horizontal-scroll/index.js | 89 + pages/component/layout/layout/layout.vue | 181 + pages/component/layout/list/list.vue | 162 + .../layout/movable-view/movable-view.vue | 60 + pages/component/layout/panel/panel.vue | 98 + pages/component/layout/preview/preview.vue | 98 + pages/component/layout/section/section.vue | 37 + .../nav/bottomNavbar/bottomNavbar.vue | 80 + .../component/nav/bottomPopup/bottomPopup.vue | 176 + pages/component/nav/bubbleBox/bubbleBox.vue | 146 + pages/component/nav/drawer/drawer.vue | 100 + pages/component/nav/fab/fab.vue | 131 + pages/component/nav/indexList-A/index.list.js | 292 ++ .../component/nav/indexList-A/indexList-A.vue | 47 + pages/component/nav/indexList-B/index.list.js | 362 ++ .../component/nav/indexList-B/indexList-B.vue | 58 + pages/component/nav/indexList/indexList.vue | 45 + pages/component/nav/link/link.vue | 48 + pages/component/nav/navbar/navbar.vue | 81 + pages/component/nav/noticeBar/noticeBar.vue | 116 + pages/component/nav/pagination/pagination.vue | 81 + .../nav/segmentedControl/segmentedControl.vue | 71 + pages/component/nav/steps/steps.vue | 121 + pages/component/nav/sticky-A/sticky-A.vue | 101 + pages/component/nav/sticky-B/sticky-B.vue | 255 ++ pages/component/nav/sticky/sticky.vue | 46 + pages/component/nav/tabbar-A/tabbar-A.vue | 181 + pages/component/nav/tabbar-B/tabbar-B.nvue | 159 + pages/component/nav/tabbar-C/pageA.vue | 61 + pages/component/nav/tabbar-C/pageB.vue | 52 + pages/component/nav/tabbar-C/pageC.vue | 52 + pages/component/nav/tabbar-C/pageD.vue | 98 + pages/component/nav/tabbar-C/tabbar-C.vue | 86 + pages/component/nav/tabbar/tabbar.vue | 53 + pages/component/nav/tabs/tabs.vue | 74 + pages/component/nav/timeAxis/timeAxis.vue | 245 ++ pages/component/nav/topPopup/topPopup.vue | 176 + pages/component/nav/vtabs-A/vtabs-A.vue | 128 + pages/component/nav/vtabs-B/vtabs-B.vue | 120 + pages/component/nav/vtabs/vtabs.vue | 50 + .../operate/actionsheet/actionsheet.vue | 86 + pages/component/operate/backdrop/backdrop.vue | 43 + pages/component/operate/dialog/dialog.vue | 64 + .../operate/dropdownList/dropdownList.vue | 176 + .../operate/dropdownMenu/dropdownMenu.vue | 234 ++ pages/component/operate/gallery/gallery.vue | 62 + .../component/operate/landscape/landscape.vue | 114 + pages/component/operate/loadAni/loadAni.vue | 118 + pages/component/operate/loading/loading.vue | 42 + pages/component/operate/lottie/lottie.vue | 79 + pages/component/operate/message/message.vue | 82 + pages/component/operate/modal/modal.vue | 177 + pages/component/operate/spin/spin.vue | 130 + .../operate/swipeAction/swipeAction.vue | 119 + pages/component/operate/toast/toast.vue | 77 + pages/layout/cardSwiper/cardSwiper.nvue | 194 + pages/layout/chatBar/chatBar.nvue | 259 ++ pages/layout/goodsBar/goodsBar.nvue | 233 ++ pages/layout/map/map.nvue | 63 + pages/layout/markerCluster/markerCluster.nvue | 29 + pages/layout/newsList/index.js | 39 + pages/layout/newsList/newsList.nvue | 122 + pages/layout/productList/index.js | 26 + pages/layout/productList/productList.nvue | 202 ++ pages/layout/rollHor/index.js | 34 + pages/layout/rollHor/rollHor.nvue | 128 + pages/layout/rollNews/rollNews.nvue | 162 + pages/layout/route/route.nvue | 265 ++ pages/layout/submitBar/submitBar.nvue | 211 ++ pages/layout/topTab/fNewsItem.nvue | 74 + pages/layout/topTab/index.js | 90 + pages/layout/topTab/topTab.nvue | 312 ++ pages/layout/waterfall/index.js | 62 + pages/layout/waterfall/waterfall.nvue | 120 + pages/my/about/about.vue | 104 + pages/my/cooperate/cooperate.vue | 350 ++ pages/my/help/help.vue | 314 ++ pages/my/log/log.vue | 560 +++ pages/my/partner/partner.vue | 81 + pages/my/qa/qa.vue | 95 + pages/my/share/share.vue | 316 ++ pages/my/updated/updated.vue | 95 + pages/my/vip/vip.vue | 256 ++ pages/my/website/website.vue | 103 + pages/my/webview/webview.vue | 23 + pages/tabbar/index/index.js | 620 ++++ pages/tabbar/index/index.vue | 256 ++ pages/tabbar/layout/index.js | 98 + pages/tabbar/layout/layout.vue | 129 + pages/tabbar/my/my.vue | 286 ++ pages/tabbar/template/index.js | 62 + pages/tabbar/template/template.vue | 134 + static/images/common/icon_kefu_3x.png | Bin 0 -> 1695 bytes static/images/common/icon_plus_3x.png | Bin 0 -> 2996 bytes static/images/common/icon_tabbar.png | Bin 0 -> 1176 bytes static/images/common/icon_tabbar_2x.png | Bin 0 -> 7863 bytes static/images/common/icon_tabbar_3x.png | Bin 0 -> 7080 bytes static/images/common/img_logo.png | Bin 0 -> 37805 bytes static/images/common/logo.png | Bin 0 -> 24797 bytes static/images/component/img_bg_poster.png | Bin 0 -> 64895 bytes static/images/component/img_goods_3x.jpg | Bin 0 -> 41743 bytes static/images/component/loading_gray.png | Bin 0 -> 1835 bytes static/images/component/loading_white.png | Bin 0 -> 2615 bytes .../images/component/tabbar/icon_classify.png | Bin 0 -> 1713 bytes .../component/tabbar/icon_classify_fill.png | Bin 0 -> 1346 bytes static/images/component/tabbar/icon_home.png | Bin 0 -> 1808 bytes .../component/tabbar/icon_home_fill.png | Bin 0 -> 1485 bytes static/images/component/tabbar/icon_my.png | Bin 0 -> 2446 bytes .../images/component/tabbar/icon_my_fill.png | Bin 0 -> 1715 bytes static/images/cooperate/light/icon_app_3x.png | Bin 0 -> 1955 bytes .../images/cooperate/light/icon_applet_3x.png | Bin 0 -> 4840 bytes .../images/cooperate/light/icon_code_3x.png | Bin 0 -> 3665 bytes .../cooperate/light/icon_cooperation_3x.png | Bin 0 -> 3652 bytes .../images/cooperate/light/icon_design_3x.png | Bin 0 -> 2371 bytes .../images/cooperate/light/icon_email_3x.png | Bin 0 -> 1633 bytes static/images/cooperate/light/icon_qq_3x.png | Bin 0 -> 1868 bytes static/images/cooperate/light/icon_web_3x.png | Bin 0 -> 2908 bytes .../images/cooperate/light/icon_weixin_3x.png | Bin 0 -> 2426 bytes .../cooperate/light/img_decorate_Left_3x.png | Bin 0 -> 639 bytes .../cooperate/light/img_decorate_right_3x.png | Bin 0 -> 646 bytes static/images/help/light/icon_assembly_3x.png | Bin 0 -> 1519 bytes static/images/help/light/icon_bug_3x.png | Bin 0 -> 1447 bytes .../images/help/light/icon_introduce_3x.png | Bin 0 -> 762 bytes .../help/light/icon_introduction_3x.png | Bin 0 -> 770 bytes static/images/help/light/icon_member_3x.png | Bin 0 -> 1502 bytes .../help/light/icon_member_relevant_3x.png | Bin 0 -> 1416 bytes static/images/help/light/icon_search_3x.png | Bin 0 -> 446 bytes static/images/index/light/icon_member_3x.png | Bin 0 -> 2077 bytes static/images/layout/icon_back_3x.png | Bin 0 -> 712 bytes static/images/layout/icon_tel_3x.png | Bin 0 -> 564 bytes static/images/layout/img_location_2x.png | Bin 0 -> 7428 bytes static/images/layout/img_rider_3x.png | Bin 0 -> 4356 bytes static/images/member/icon_date_3x.png | Bin 0 -> 1081 bytes static/images/member/icon_difference_3x.png | Bin 0 -> 585 bytes static/images/member/icon_vip_3x.png | Bin 0 -> 1618 bytes static/images/member/light/img_layer_3x.png | Bin 0 -> 21786 bytes static/images/my/light/icon_aboutus_3x.png | Bin 0 -> 750 bytes static/images/my/light/icon_address_3x.png | Bin 0 -> 599 bytes static/images/my/light/icon_edition_3x.png | Bin 0 -> 491 bytes static/images/my/light/icon_help_3x.png | Bin 0 -> 1001 bytes static/images/my/light/icon_partner_3x.png | Bin 0 -> 1120 bytes static/images/qrcode/ali_qrcode.png | Bin 0 -> 14131 bytes static/images/qrcode/baidu_qrcode.png | Bin 0 -> 16418 bytes static/images/qrcode/h5_qrcode.png | Bin 0 -> 14796 bytes static/images/qrcode/qq_qrcode.jpg | Bin 0 -> 38061 bytes static/images/qrcode/toutiao_qrcode.png | Bin 0 -> 38585 bytes static/images/qrcode/wx_qrcode.jpg | Bin 0 -> 30821 bytes static/images/share/icon_picture_3x.png | Bin 0 -> 667 bytes static/images/share/icon_share_3x.png | Bin 0 -> 833 bytes static/images/share/img_bg_3x.png | Bin 0 -> 11721 bytes static/images/tabbar/assembly_default_3x.png | Bin 0 -> 4868 bytes static/images/tabbar/assembly_selected_3x.png | Bin 0 -> 3756 bytes static/images/tabbar/layout_default_3x.png | Bin 0 -> 1761 bytes static/images/tabbar/layout_selected_3x.png | Bin 0 -> 1839 bytes static/images/tabbar/mod_default_3x.png | Bin 0 -> 1260 bytes static/images/tabbar/mod_selected_3x.png | Bin 0 -> 1259 bytes static/images/tabbar/my_default_3x.png | Bin 0 -> 3208 bytes static/images/tabbar/my_selected_3x.png | Bin 0 -> 2581 bytes .../images/website/light/icon_applets_3x.png | Bin 0 -> 1424 bytes static/images/website/light/icon_file_3x.png | Bin 0 -> 496 bytes .../images/website/light/icon_github_3x.png | Bin 0 -> 1103 bytes static/images/website/light/icon_uni_3x.png | Bin 0 -> 380 bytes .../images/website/light/icon_website_3x.png | Bin 0 -> 515 bytes static/json/nodata.json | 1 + store/index.js | 86 + 571 files changed, 95322 insertions(+) create mode 100644 .gitignore create mode 100644 .hbuilderx/launch.json create mode 100644 .npmrc create mode 100644 App.vue create mode 100644 common/fui-app.css create mode 100644 common/fui-app.js create mode 100644 common/fui-request.js create mode 100644 components/firstui/fui-actionsheet/fui-actionsheet.vue create mode 100644 components/firstui/fui-alert/fui-alert.vue create mode 100644 components/firstui/fui-animation/fui-animation.vue create mode 100644 components/firstui/fui-autograph/fui-autograph.vue create mode 100644 components/firstui/fui-autograph/gcanvas/bridge/bridge-weex.js create mode 100644 components/firstui/fui-autograph/gcanvas/context-2d/FillStyleLinearGradient.js create mode 100644 components/firstui/fui-autograph/gcanvas/context-2d/FillStylePattern.js create mode 100644 components/firstui/fui-autograph/gcanvas/context-2d/FillStyleRadialGradient.js create mode 100644 components/firstui/fui-autograph/gcanvas/context-2d/RenderingContext.js create mode 100644 components/firstui/fui-autograph/gcanvas/context-webgl/ActiveInfo.js create mode 100644 components/firstui/fui-autograph/gcanvas/context-webgl/Buffer.js create mode 100644 components/firstui/fui-autograph/gcanvas/context-webgl/Framebuffer.js create mode 100644 components/firstui/fui-autograph/gcanvas/context-webgl/GLenum.js create mode 100644 components/firstui/fui-autograph/gcanvas/context-webgl/GLmethod.js create mode 100644 components/firstui/fui-autograph/gcanvas/context-webgl/GLtype.js create mode 100644 components/firstui/fui-autograph/gcanvas/context-webgl/Program.js create mode 100644 components/firstui/fui-autograph/gcanvas/context-webgl/Renderbuffer.js create mode 100644 components/firstui/fui-autograph/gcanvas/context-webgl/RenderingContext.js create mode 100644 components/firstui/fui-autograph/gcanvas/context-webgl/Shader.js create mode 100644 components/firstui/fui-autograph/gcanvas/context-webgl/ShaderPrecisionFormat.js create mode 100644 components/firstui/fui-autograph/gcanvas/context-webgl/Texture.js create mode 100644 components/firstui/fui-autograph/gcanvas/context-webgl/UniformLocation.js create mode 100644 components/firstui/fui-autograph/gcanvas/context-webgl/classUtils.js create mode 100644 components/firstui/fui-autograph/gcanvas/env/canvas.js create mode 100644 components/firstui/fui-autograph/gcanvas/env/image.js create mode 100644 components/firstui/fui-autograph/gcanvas/env/tool.js create mode 100644 components/firstui/fui-autograph/gcanvas/index.js create mode 100644 components/firstui/fui-avatar/fui-avatar.vue create mode 100644 components/firstui/fui-backdrop/fui-backdrop.vue create mode 100644 components/firstui/fui-backtop/fui-backtop.vue create mode 100644 components/firstui/fui-badge/fui-badge.vue create mode 100644 components/firstui/fui-banner-arc/fui-banner-arc.vue create mode 100644 components/firstui/fui-barcode/barcode.js create mode 100644 components/firstui/fui-barcode/fui-barcode.vue create mode 100644 components/firstui/fui-barcode/gcanvas/bridge/bridge-weex.js create mode 100644 components/firstui/fui-barcode/gcanvas/context-2d/FillStyleLinearGradient.js create mode 100644 components/firstui/fui-barcode/gcanvas/context-2d/FillStylePattern.js create mode 100644 components/firstui/fui-barcode/gcanvas/context-2d/FillStyleRadialGradient.js create mode 100644 components/firstui/fui-barcode/gcanvas/context-2d/RenderingContext.js create mode 100644 components/firstui/fui-barcode/gcanvas/context-webgl/ActiveInfo.js create mode 100644 components/firstui/fui-barcode/gcanvas/context-webgl/Buffer.js create mode 100644 components/firstui/fui-barcode/gcanvas/context-webgl/Framebuffer.js create mode 100644 components/firstui/fui-barcode/gcanvas/context-webgl/GLenum.js create mode 100644 components/firstui/fui-barcode/gcanvas/context-webgl/GLmethod.js create mode 100644 components/firstui/fui-barcode/gcanvas/context-webgl/GLtype.js create mode 100644 components/firstui/fui-barcode/gcanvas/context-webgl/Program.js create mode 100644 components/firstui/fui-barcode/gcanvas/context-webgl/Renderbuffer.js create mode 100644 components/firstui/fui-barcode/gcanvas/context-webgl/RenderingContext.js create mode 100644 components/firstui/fui-barcode/gcanvas/context-webgl/Shader.js create mode 100644 components/firstui/fui-barcode/gcanvas/context-webgl/ShaderPrecisionFormat.js create mode 100644 components/firstui/fui-barcode/gcanvas/context-webgl/Texture.js create mode 100644 components/firstui/fui-barcode/gcanvas/context-webgl/UniformLocation.js create mode 100644 components/firstui/fui-barcode/gcanvas/context-webgl/classUtils.js create mode 100644 components/firstui/fui-barcode/gcanvas/env/canvas.js create mode 100644 components/firstui/fui-barcode/gcanvas/env/image.js create mode 100644 components/firstui/fui-barcode/gcanvas/env/tool.js create mode 100644 components/firstui/fui-barcode/gcanvas/index.js create mode 100644 components/firstui/fui-bottom-navbar/fui-bottom-navbar.vue create mode 100644 components/firstui/fui-bottom-popup/fui-bottom-popup.vue create mode 100644 components/firstui/fui-bubble-box/fui-bubble-box.vue create mode 100644 components/firstui/fui-button/fui-button.vue create mode 100644 components/firstui/fui-calendar/fui-calendar.vue create mode 100644 components/firstui/fui-calendar/index.js create mode 100644 components/firstui/fui-card/fui-card.vue create mode 100644 components/firstui/fui-cascader/fui-cascader.vue create mode 100644 components/firstui/fui-checkbox-group/fui-checkbox-group.vue create mode 100644 components/firstui/fui-checkbox/fui-checkbox.vue create mode 100644 components/firstui/fui-circle/fui-circle.vue create mode 100644 components/firstui/fui-circle/gcanvas/bridge/bridge-weex.js create mode 100644 components/firstui/fui-circle/gcanvas/context-2d/FillStyleLinearGradient.js create mode 100644 components/firstui/fui-circle/gcanvas/context-2d/FillStylePattern.js create mode 100644 components/firstui/fui-circle/gcanvas/context-2d/FillStyleRadialGradient.js create mode 100644 components/firstui/fui-circle/gcanvas/context-2d/RenderingContext.js create mode 100644 components/firstui/fui-circle/gcanvas/context-webgl/ActiveInfo.js create mode 100644 components/firstui/fui-circle/gcanvas/context-webgl/Buffer.js create mode 100644 components/firstui/fui-circle/gcanvas/context-webgl/Framebuffer.js create mode 100644 components/firstui/fui-circle/gcanvas/context-webgl/GLenum.js create mode 100644 components/firstui/fui-circle/gcanvas/context-webgl/GLmethod.js create mode 100644 components/firstui/fui-circle/gcanvas/context-webgl/GLtype.js create mode 100644 components/firstui/fui-circle/gcanvas/context-webgl/Program.js create mode 100644 components/firstui/fui-circle/gcanvas/context-webgl/Renderbuffer.js create mode 100644 components/firstui/fui-circle/gcanvas/context-webgl/RenderingContext.js create mode 100644 components/firstui/fui-circle/gcanvas/context-webgl/Shader.js create mode 100644 components/firstui/fui-circle/gcanvas/context-webgl/ShaderPrecisionFormat.js create mode 100644 components/firstui/fui-circle/gcanvas/context-webgl/Texture.js create mode 100644 components/firstui/fui-circle/gcanvas/context-webgl/UniformLocation.js create mode 100644 components/firstui/fui-circle/gcanvas/context-webgl/classUtils.js create mode 100644 components/firstui/fui-circle/gcanvas/env/canvas.js create mode 100644 components/firstui/fui-circle/gcanvas/env/image.js create mode 100644 components/firstui/fui-circle/gcanvas/env/tool.js create mode 100644 components/firstui/fui-circle/gcanvas/index.js create mode 100644 components/firstui/fui-circle/mpjs.js create mode 100644 components/firstui/fui-circle/nvue.js create mode 100644 components/firstui/fui-circle/render.js create mode 100644 components/firstui/fui-clipboard/clipboard.min.js create mode 100644 components/firstui/fui-clipboard/index.js create mode 100644 components/firstui/fui-col/fui-col.vue create mode 100644 components/firstui/fui-collapse-item/fui-collapse-item.vue create mode 100644 components/firstui/fui-collapse/fui-collapse.vue create mode 100644 components/firstui/fui-config/index.js create mode 100644 components/firstui/fui-copy-text/fui-copy-text.vue create mode 100644 components/firstui/fui-copy-text/lib/clipboard.min.js create mode 100644 components/firstui/fui-copy-text/lib/index.js create mode 100644 components/firstui/fui-count-down/fui-count-down.vue create mode 100644 components/firstui/fui-countdown-verify/fui-countdown-verify.vue create mode 100644 components/firstui/fui-cubic-bezier/fui-cubic-bezier.vue create mode 100644 components/firstui/fui-data-tag/fui-data-tag.vue create mode 100644 components/firstui/fui-date-picker/fui-date-picker.vue create mode 100644 components/firstui/fui-dialog/fui-dialog.vue create mode 100644 components/firstui/fui-digital-keyboard/fui-digital-keyboard.vue create mode 100644 components/firstui/fui-digital-roller/fui-digital-roller.vue create mode 100644 components/firstui/fui-divider/fui-divider.vue create mode 100644 components/firstui/fui-drag/bindingx.js create mode 100644 components/firstui/fui-drag/f-drag-item.vue create mode 100644 components/firstui/fui-drag/fui-drag.vue create mode 100644 components/firstui/fui-drag/index.wxs create mode 100644 components/firstui/fui-drag/mpjs.js create mode 100644 components/firstui/fui-drawer/fui-drawer.vue create mode 100644 components/firstui/fui-dropdown-list/fui-dropdown-list.vue create mode 100644 components/firstui/fui-dropdown-menu/fui-dropdown-menu.vue create mode 100644 components/firstui/fui-empty/fui-empty.vue create mode 100644 components/firstui/fui-fab/bindingx.js create mode 100644 components/firstui/fui-fab/fui-fab.vue create mode 100644 components/firstui/fui-fab/index.wxs create mode 100644 components/firstui/fui-fab/mpjs.js create mode 100644 components/firstui/fui-filter-bar/fui-filter-bar.vue create mode 100644 components/firstui/fui-footer/fui-footer.vue create mode 100644 components/firstui/fui-form-field/fui-form-field.vue create mode 100644 components/firstui/fui-form-item/fui-form-item.vue create mode 100644 components/firstui/fui-form/fui-form.vue create mode 100644 components/firstui/fui-form/fui-validator.js create mode 100644 components/firstui/fui-gallery/fui-gallery.vue create mode 100644 components/firstui/fui-grid-item/fui-grid-item.vue create mode 100644 components/firstui/fui-grid/fui-grid.vue create mode 100644 components/firstui/fui-horizontal-scroll/bindingx.js create mode 100644 components/firstui/fui-horizontal-scroll/fui-horizontal-scroll.vue create mode 100644 components/firstui/fui-horizontal-scroll/index.wxs create mode 100644 components/firstui/fui-horizontal-scroll/mpjs.js create mode 100644 components/firstui/fui-icon/fui-icon.js create mode 100644 components/firstui/fui-icon/fui-icon.ttf create mode 100644 components/firstui/fui-icon/fui-icon.vue create mode 100644 components/firstui/fui-image-cropper/bindingx.js create mode 100644 components/firstui/fui-image-cropper/fui-image-cropper.vue create mode 100644 components/firstui/fui-image-cropper/index.wxs create mode 100644 components/firstui/fui-image-cropper/mpjs.js create mode 100644 components/firstui/fui-index-list/f-index-list-item.vue create mode 100644 components/firstui/fui-index-list/fui-index-list.vue create mode 100644 components/firstui/fui-input-number/fui-input-number.vue create mode 100644 components/firstui/fui-input/fui-input.vue create mode 100644 components/firstui/fui-label/fui-label.vue create mode 100644 components/firstui/fui-landscape/fui-landscape.vue create mode 100644 components/firstui/fui-lazyload/fui-lazyload.vue create mode 100644 components/firstui/fui-license-plate/fui-license-plate.js create mode 100644 components/firstui/fui-license-plate/fui-license-plate.vue create mode 100644 components/firstui/fui-link/fui-link.vue create mode 100644 components/firstui/fui-list-cell/fui-list-cell.vue create mode 100644 components/firstui/fui-list/fui-list.vue create mode 100644 components/firstui/fui-load-ani/fui-load-ani.vue create mode 100644 components/firstui/fui-loading/fui-loading.vue create mode 100644 components/firstui/fui-loadmore/fui-loadmore.vue create mode 100644 components/firstui/fui-lottie/fui-lottie-app.js create mode 100644 components/firstui/fui-lottie/fui-lottie-mp.js create mode 100644 components/firstui/fui-lottie/fui-lottie.vue create mode 100644 components/firstui/fui-message/fui-message.vue create mode 100644 components/firstui/fui-modal/fui-modal.vue create mode 100644 components/firstui/fui-movable-view/bindingx.js create mode 100644 components/firstui/fui-movable-view/fui-movable-view.vue create mode 100644 components/firstui/fui-movable-view/index.wxs create mode 100644 components/firstui/fui-movable-view/mpjs.js create mode 100644 components/firstui/fui-nav-bar/fui-nav-bar.vue create mode 100644 components/firstui/fui-notice-bar/fui-notice-bar.vue create mode 100644 components/firstui/fui-overflow-hidden/fui-overflow-hidden.vue create mode 100644 components/firstui/fui-pagination/fui-pagination.vue create mode 100644 components/firstui/fui-panel/fui-panel.vue create mode 100644 components/firstui/fui-picker/fui-picker.vue create mode 100644 components/firstui/fui-poster-weex/fui-poster-weex.vue create mode 100644 components/firstui/fui-poster-weex/gcanvas/bridge/bridge-weex.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/context-2d/FillStyleLinearGradient.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/context-2d/FillStylePattern.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/context-2d/FillStyleRadialGradient.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/context-2d/RenderingContext.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/context-webgl/ActiveInfo.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/context-webgl/Buffer.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/context-webgl/Framebuffer.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/context-webgl/GLenum.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/context-webgl/GLmethod.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/context-webgl/GLtype.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/context-webgl/Program.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/context-webgl/Renderbuffer.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/context-webgl/RenderingContext.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/context-webgl/Shader.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/context-webgl/ShaderPrecisionFormat.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/context-webgl/Texture.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/context-webgl/UniformLocation.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/context-webgl/classUtils.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/env/canvas.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/env/image.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/env/tool.js create mode 100644 components/firstui/fui-poster-weex/gcanvas/index.js create mode 100644 components/firstui/fui-poster/fui-poster.vue create mode 100644 components/firstui/fui-poster/index.js create mode 100644 components/firstui/fui-preview/fui-preview.vue create mode 100644 components/firstui/fui-progress/fui-progress.vue create mode 100644 components/firstui/fui-puzzle-verify/fui-puzzle-verify.vue create mode 100644 components/firstui/fui-puzzle-verify/index.wxs create mode 100644 components/firstui/fui-puzzle-verify/mpjs.js create mode 100644 components/firstui/fui-puzzle-verify/weex.js create mode 100644 components/firstui/fui-qrcode/fui-qr/index.js create mode 100644 components/firstui/fui-qrcode/fui-qr/lib/8BitByte.js create mode 100644 components/firstui/fui-qrcode/fui-qr/lib/BitBuffer.js create mode 100644 components/firstui/fui-qrcode/fui-qr/lib/ErrorCorrectLevel.js create mode 100644 components/firstui/fui-qrcode/fui-qr/lib/LICENSE-qrcode create mode 100644 components/firstui/fui-qrcode/fui-qr/lib/Polynomial.js create mode 100644 components/firstui/fui-qrcode/fui-qr/lib/QRCode.js create mode 100644 components/firstui/fui-qrcode/fui-qr/lib/RSBlock.js create mode 100644 components/firstui/fui-qrcode/fui-qr/lib/math.js create mode 100644 components/firstui/fui-qrcode/fui-qr/lib/mode.js create mode 100644 components/firstui/fui-qrcode/fui-qr/lib/util.js create mode 100644 components/firstui/fui-qrcode/fui-qrcode.vue create mode 100644 components/firstui/fui-qrcode/gcanvas/bridge/bridge-weex.js create mode 100644 components/firstui/fui-qrcode/gcanvas/context-2d/FillStyleLinearGradient.js create mode 100644 components/firstui/fui-qrcode/gcanvas/context-2d/FillStylePattern.js create mode 100644 components/firstui/fui-qrcode/gcanvas/context-2d/FillStyleRadialGradient.js create mode 100644 components/firstui/fui-qrcode/gcanvas/context-2d/RenderingContext.js create mode 100644 components/firstui/fui-qrcode/gcanvas/context-webgl/ActiveInfo.js create mode 100644 components/firstui/fui-qrcode/gcanvas/context-webgl/Buffer.js create mode 100644 components/firstui/fui-qrcode/gcanvas/context-webgl/Framebuffer.js create mode 100644 components/firstui/fui-qrcode/gcanvas/context-webgl/GLenum.js create mode 100644 components/firstui/fui-qrcode/gcanvas/context-webgl/GLmethod.js create mode 100644 components/firstui/fui-qrcode/gcanvas/context-webgl/GLtype.js create mode 100644 components/firstui/fui-qrcode/gcanvas/context-webgl/Program.js create mode 100644 components/firstui/fui-qrcode/gcanvas/context-webgl/Renderbuffer.js create mode 100644 components/firstui/fui-qrcode/gcanvas/context-webgl/RenderingContext.js create mode 100644 components/firstui/fui-qrcode/gcanvas/context-webgl/Shader.js create mode 100644 components/firstui/fui-qrcode/gcanvas/context-webgl/ShaderPrecisionFormat.js create mode 100644 components/firstui/fui-qrcode/gcanvas/context-webgl/Texture.js create mode 100644 components/firstui/fui-qrcode/gcanvas/context-webgl/UniformLocation.js create mode 100644 components/firstui/fui-qrcode/gcanvas/context-webgl/classUtils.js create mode 100644 components/firstui/fui-qrcode/gcanvas/env/canvas.js create mode 100644 components/firstui/fui-qrcode/gcanvas/env/image.js create mode 100644 components/firstui/fui-qrcode/gcanvas/env/tool.js create mode 100644 components/firstui/fui-qrcode/gcanvas/index.js create mode 100644 components/firstui/fui-radio-group/fui-radio-group.vue create mode 100644 components/firstui/fui-radio/fui-radio.vue create mode 100644 components/firstui/fui-rate/fui-rate.vue create mode 100644 components/firstui/fui-request/fui-common.js create mode 100644 components/firstui/fui-request/fui-taskStore.js create mode 100644 components/firstui/fui-request/index.js create mode 100644 components/firstui/fui-result/fui-result.vue create mode 100644 components/firstui/fui-rotate-verify/fui-rotate-verify.vue create mode 100644 components/firstui/fui-rotate-verify/index.wxs create mode 100644 components/firstui/fui-rotate-verify/mpjs.js create mode 100644 components/firstui/fui-rotate-verify/weex.js create mode 100644 components/firstui/fui-row/fui-row.vue create mode 100644 components/firstui/fui-safe-area/fui-safe-area.vue create mode 100644 components/firstui/fui-search-bar/fui-search-bar.vue create mode 100644 components/firstui/fui-section/fui-section.vue create mode 100644 components/firstui/fui-segmented-control/fui-segmented-control.vue create mode 100644 components/firstui/fui-select/fui-select.vue create mode 100644 components/firstui/fui-share-sheet/fui-share-sheet.vue create mode 100644 components/firstui/fui-single-input/fui-single-input.vue create mode 100644 components/firstui/fui-skeleton/fui-skeleton.vue create mode 100644 components/firstui/fui-slide-verify/fui-slide-verify.vue create mode 100644 components/firstui/fui-slide-verify/index.wxs create mode 100644 components/firstui/fui-slide-verify/mpjs.js create mode 100644 components/firstui/fui-slide-verify/weex.js create mode 100644 components/firstui/fui-slider-captcha/fui-slider-captcha.vue create mode 100644 components/firstui/fui-slider-captcha/index.wxs create mode 100644 components/firstui/fui-slider-captcha/mpjs.js create mode 100644 components/firstui/fui-slider-captcha/weex.js create mode 100644 components/firstui/fui-slider/bindingx.js create mode 100644 components/firstui/fui-slider/fui-slider.vue create mode 100644 components/firstui/fui-slider/index.wxs create mode 100644 components/firstui/fui-slider/mpjs.js create mode 100644 components/firstui/fui-spin/fui-spin.vue create mode 100644 components/firstui/fui-status-bar/fui-status-bar.vue create mode 100644 components/firstui/fui-steps/fui-steps.vue create mode 100644 components/firstui/fui-sticky/fui-sticky.vue create mode 100644 components/firstui/fui-swipe-action/bindingx.js create mode 100644 components/firstui/fui-swipe-action/fui-swipe-action.vue create mode 100644 components/firstui/fui-swipe-action/index.wxs create mode 100644 components/firstui/fui-swipe-action/mpjs.js create mode 100644 components/firstui/fui-swipe-action/mpwxs.js create mode 100644 components/firstui/fui-swipeaction-group/fui-swipeaction-group.vue create mode 100644 components/firstui/fui-swiper-dot/fui-swiper-dot.vue create mode 100644 components/firstui/fui-switch/fui-switch.vue create mode 100644 components/firstui/fui-tabbar/fui-tabbar.vue create mode 100644 components/firstui/fui-table/fui-table.vue create mode 100644 components/firstui/fui-tabs/fui-tabs.vue create mode 100644 components/firstui/fui-tag/fui-tag.vue create mode 100644 components/firstui/fui-text/fui-text.vue create mode 100644 components/firstui/fui-textarea/fui-textarea.vue create mode 100644 components/firstui/fui-theme/fui-theme.css create mode 100644 components/firstui/fui-timeaxis-node/fui-timeaxis-node.vue create mode 100644 components/firstui/fui-timeaxis/fui-timeaxis.vue create mode 100644 components/firstui/fui-timer/fui-timer.vue create mode 100644 components/firstui/fui-toast/fui-toast.vue create mode 100644 components/firstui/fui-top-popup/fui-top-popup.vue create mode 100644 components/firstui/fui-upload-video/fui-upload-video.vue create mode 100644 components/firstui/fui-upload/fui-upload.vue create mode 100644 components/firstui/fui-utils/index.js create mode 100644 components/firstui/fui-validator/fui-validator.js create mode 100644 components/firstui/fui-vtabs-content/fui-vtabs-content.vue create mode 100644 components/firstui/fui-vtabs/fui-vtabs.vue create mode 100644 components/firstui/fui-waterfall-item/fui-waterfall-item.vue create mode 100644 components/firstui/fui-waterfall/fui-waterfall.vue create mode 100644 favicon.ico create mode 100644 index.html create mode 100644 libs/qqmap-wx-jssdk.min.js create mode 100644 main.js create mode 100644 manifest.json create mode 100644 package.json create mode 100644 pages.json create mode 100644 pages/common/coding/coding.vue create mode 100644 pages/component/basics/animation/animation.vue create mode 100644 pages/component/basics/button/button.vue create mode 100644 pages/component/basics/color/color.js create mode 100644 pages/component/basics/color/color.vue create mode 100644 pages/component/basics/footer/footer.vue create mode 100644 pages/component/basics/icon/icon.js create mode 100644 pages/component/basics/icon/icon.vue create mode 100644 pages/component/basics/text/text.vue create mode 100644 pages/component/canvas/autograph/autograph.vue create mode 100644 pages/component/canvas/barcode/barcode.vue create mode 100644 pages/component/canvas/poster/poster.vue create mode 100644 pages/component/canvas/qrcode/qrcode.vue create mode 100644 pages/component/data/alert/alert.vue create mode 100644 pages/component/data/avatar/avatar.vue create mode 100644 pages/component/data/badge/badge.vue create mode 100644 pages/component/data/circle/circle.vue create mode 100644 pages/component/data/collapse/collapse.vue create mode 100644 pages/component/data/countdown/countdown.vue create mode 100644 pages/component/data/dataTag/dataTag.vue create mode 100644 pages/component/data/divider/divider.vue create mode 100644 pages/component/data/empty/empty.vue create mode 100644 pages/component/data/loadmore/loadmore.vue create mode 100644 pages/component/data/progress/progress.vue create mode 100644 pages/component/data/skeleton/skeleton.vue create mode 100644 pages/component/data/tag/tag.vue create mode 100644 pages/component/expand/backtop/backtop.vue create mode 100644 pages/component/expand/copyText/copyText.vue create mode 100644 pages/component/expand/countdownVerify/countdownVerify.vue create mode 100644 pages/component/expand/cubicBezier/cubicBezier.vue create mode 100644 pages/component/expand/digitalKeyboard/digitalKeyboard.vue create mode 100644 pages/component/expand/digitalRoller/digitalRoller.vue create mode 100644 pages/component/expand/drag-custom/drag-custom.vue create mode 100644 pages/component/expand/drag-img/drag-img.vue create mode 100644 pages/component/expand/drag-text/drag-text.vue create mode 100644 pages/component/expand/drag/drag.vue create mode 100644 pages/component/expand/filterBar/filterBar.vue create mode 100644 pages/component/expand/imageCropper/imageCropper.vue create mode 100644 pages/component/expand/lazyload/lazyload.vue create mode 100644 pages/component/expand/licensePlate/licensePlate.vue create mode 100644 pages/component/expand/overflowHidden/overflowHidden.vue create mode 100644 pages/component/expand/puzzleVerify/puzzleVerify.vue create mode 100644 pages/component/expand/result-eg/result-eg.vue create mode 100644 pages/component/expand/result/result.vue create mode 100644 pages/component/expand/rotateVerify/rotateVerify.vue create mode 100644 pages/component/expand/safeArea/safeArea.vue create mode 100644 pages/component/expand/shareSheet/shareSheet.vue create mode 100644 pages/component/expand/singleInput-A/singleInput-A.vue create mode 100644 pages/component/expand/singleInput-B/singleInput-B.vue create mode 100644 pages/component/expand/singleInput/singleInput.vue create mode 100644 pages/component/expand/slideVerify/slideVerify.vue create mode 100644 pages/component/expand/sliderCaptcha/sliderCaptcha.vue create mode 100644 pages/component/expand/swiperDot/swiperDot.vue create mode 100644 pages/component/expand/table/table.vue create mode 100644 pages/component/expand/table/tableData.js create mode 100644 pages/component/expand/timer/timer.vue create mode 100644 pages/component/expand/waterfall/waterfall.vue create mode 100644 pages/component/form/calendar/calendar.vue create mode 100644 pages/component/form/cascader/cascader.vue create mode 100644 pages/component/form/cascader/data.js create mode 100644 pages/component/form/checkbox/checkbox.vue create mode 100644 pages/component/form/datePicker/datePicker.vue create mode 100644 pages/component/form/form/form.vue create mode 100644 pages/component/form/formItem/formItem.vue create mode 100644 pages/component/form/input/input.vue create mode 100644 pages/component/form/inputNumber/inputNumber.vue create mode 100644 pages/component/form/label/label.vue create mode 100644 pages/component/form/picker/picker.js create mode 100644 pages/component/form/picker/picker.vue create mode 100644 pages/component/form/radio/radio.vue create mode 100644 pages/component/form/rate/rate.vue create mode 100644 pages/component/form/searchBar/searchBar.vue create mode 100644 pages/component/form/select/select.vue create mode 100644 pages/component/form/slider/slider.vue create mode 100644 pages/component/form/switch/switch.vue create mode 100644 pages/component/form/textarea/textarea.vue create mode 100644 pages/component/form/upload/upload.vue create mode 100644 pages/component/form/uploadVideo/uploadVideo.vue create mode 100644 pages/component/js/clipboard/clipboard.vue create mode 100644 pages/component/js/request/request.vue create mode 100644 pages/component/js/utils/utils.vue create mode 100644 pages/component/js/validator/validator.vue create mode 100644 pages/component/layout/arc/arc.vue create mode 100644 pages/component/layout/card/card.vue create mode 100644 pages/component/layout/grid/grid.vue create mode 100644 pages/component/layout/horizontal-scroll/horizontal-scroll.vue create mode 100644 pages/component/layout/horizontal-scroll/index.js create mode 100644 pages/component/layout/layout/layout.vue create mode 100644 pages/component/layout/list/list.vue create mode 100644 pages/component/layout/movable-view/movable-view.vue create mode 100644 pages/component/layout/panel/panel.vue create mode 100644 pages/component/layout/preview/preview.vue create mode 100644 pages/component/layout/section/section.vue create mode 100644 pages/component/nav/bottomNavbar/bottomNavbar.vue create mode 100644 pages/component/nav/bottomPopup/bottomPopup.vue create mode 100644 pages/component/nav/bubbleBox/bubbleBox.vue create mode 100644 pages/component/nav/drawer/drawer.vue create mode 100644 pages/component/nav/fab/fab.vue create mode 100644 pages/component/nav/indexList-A/index.list.js create mode 100644 pages/component/nav/indexList-A/indexList-A.vue create mode 100644 pages/component/nav/indexList-B/index.list.js create mode 100644 pages/component/nav/indexList-B/indexList-B.vue create mode 100644 pages/component/nav/indexList/indexList.vue create mode 100644 pages/component/nav/link/link.vue create mode 100644 pages/component/nav/navbar/navbar.vue create mode 100644 pages/component/nav/noticeBar/noticeBar.vue create mode 100644 pages/component/nav/pagination/pagination.vue create mode 100644 pages/component/nav/segmentedControl/segmentedControl.vue create mode 100644 pages/component/nav/steps/steps.vue create mode 100644 pages/component/nav/sticky-A/sticky-A.vue create mode 100644 pages/component/nav/sticky-B/sticky-B.vue create mode 100644 pages/component/nav/sticky/sticky.vue create mode 100644 pages/component/nav/tabbar-A/tabbar-A.vue create mode 100644 pages/component/nav/tabbar-B/tabbar-B.nvue create mode 100644 pages/component/nav/tabbar-C/pageA.vue create mode 100644 pages/component/nav/tabbar-C/pageB.vue create mode 100644 pages/component/nav/tabbar-C/pageC.vue create mode 100644 pages/component/nav/tabbar-C/pageD.vue create mode 100644 pages/component/nav/tabbar-C/tabbar-C.vue create mode 100644 pages/component/nav/tabbar/tabbar.vue create mode 100644 pages/component/nav/tabs/tabs.vue create mode 100644 pages/component/nav/timeAxis/timeAxis.vue create mode 100644 pages/component/nav/topPopup/topPopup.vue create mode 100644 pages/component/nav/vtabs-A/vtabs-A.vue create mode 100644 pages/component/nav/vtabs-B/vtabs-B.vue create mode 100644 pages/component/nav/vtabs/vtabs.vue create mode 100644 pages/component/operate/actionsheet/actionsheet.vue create mode 100644 pages/component/operate/backdrop/backdrop.vue create mode 100644 pages/component/operate/dialog/dialog.vue create mode 100644 pages/component/operate/dropdownList/dropdownList.vue create mode 100644 pages/component/operate/dropdownMenu/dropdownMenu.vue create mode 100644 pages/component/operate/gallery/gallery.vue create mode 100644 pages/component/operate/landscape/landscape.vue create mode 100644 pages/component/operate/loadAni/loadAni.vue create mode 100644 pages/component/operate/loading/loading.vue create mode 100644 pages/component/operate/lottie/lottie.vue create mode 100644 pages/component/operate/message/message.vue create mode 100644 pages/component/operate/modal/modal.vue create mode 100644 pages/component/operate/spin/spin.vue create mode 100644 pages/component/operate/swipeAction/swipeAction.vue create mode 100644 pages/component/operate/toast/toast.vue create mode 100644 pages/layout/cardSwiper/cardSwiper.nvue create mode 100644 pages/layout/chatBar/chatBar.nvue create mode 100644 pages/layout/goodsBar/goodsBar.nvue create mode 100644 pages/layout/map/map.nvue create mode 100644 pages/layout/markerCluster/markerCluster.nvue create mode 100644 pages/layout/newsList/index.js create mode 100644 pages/layout/newsList/newsList.nvue create mode 100644 pages/layout/productList/index.js create mode 100644 pages/layout/productList/productList.nvue create mode 100644 pages/layout/rollHor/index.js create mode 100644 pages/layout/rollHor/rollHor.nvue create mode 100644 pages/layout/rollNews/rollNews.nvue create mode 100644 pages/layout/route/route.nvue create mode 100644 pages/layout/submitBar/submitBar.nvue create mode 100644 pages/layout/topTab/fNewsItem.nvue create mode 100644 pages/layout/topTab/index.js create mode 100644 pages/layout/topTab/topTab.nvue create mode 100644 pages/layout/waterfall/index.js create mode 100644 pages/layout/waterfall/waterfall.nvue create mode 100644 pages/my/about/about.vue create mode 100644 pages/my/cooperate/cooperate.vue create mode 100644 pages/my/help/help.vue create mode 100644 pages/my/log/log.vue create mode 100644 pages/my/partner/partner.vue create mode 100644 pages/my/qa/qa.vue create mode 100644 pages/my/share/share.vue create mode 100644 pages/my/updated/updated.vue create mode 100644 pages/my/vip/vip.vue create mode 100644 pages/my/website/website.vue create mode 100644 pages/my/webview/webview.vue create mode 100644 pages/tabbar/index/index.js create mode 100644 pages/tabbar/index/index.vue create mode 100644 pages/tabbar/layout/index.js create mode 100644 pages/tabbar/layout/layout.vue create mode 100644 pages/tabbar/my/my.vue create mode 100644 pages/tabbar/template/index.js create mode 100644 pages/tabbar/template/template.vue create mode 100644 static/images/common/icon_kefu_3x.png create mode 100644 static/images/common/icon_plus_3x.png create mode 100644 static/images/common/icon_tabbar.png create mode 100644 static/images/common/icon_tabbar_2x.png create mode 100644 static/images/common/icon_tabbar_3x.png create mode 100644 static/images/common/img_logo.png create mode 100644 static/images/common/logo.png create mode 100644 static/images/component/img_bg_poster.png create mode 100644 static/images/component/img_goods_3x.jpg create mode 100644 static/images/component/loading_gray.png create mode 100644 static/images/component/loading_white.png create mode 100644 static/images/component/tabbar/icon_classify.png create mode 100644 static/images/component/tabbar/icon_classify_fill.png create mode 100644 static/images/component/tabbar/icon_home.png create mode 100644 static/images/component/tabbar/icon_home_fill.png create mode 100644 static/images/component/tabbar/icon_my.png create mode 100644 static/images/component/tabbar/icon_my_fill.png create mode 100644 static/images/cooperate/light/icon_app_3x.png create mode 100644 static/images/cooperate/light/icon_applet_3x.png create mode 100644 static/images/cooperate/light/icon_code_3x.png create mode 100644 static/images/cooperate/light/icon_cooperation_3x.png create mode 100644 static/images/cooperate/light/icon_design_3x.png create mode 100644 static/images/cooperate/light/icon_email_3x.png create mode 100644 static/images/cooperate/light/icon_qq_3x.png create mode 100644 static/images/cooperate/light/icon_web_3x.png create mode 100644 static/images/cooperate/light/icon_weixin_3x.png create mode 100644 static/images/cooperate/light/img_decorate_Left_3x.png create mode 100644 static/images/cooperate/light/img_decorate_right_3x.png create mode 100644 static/images/help/light/icon_assembly_3x.png create mode 100644 static/images/help/light/icon_bug_3x.png create mode 100644 static/images/help/light/icon_introduce_3x.png create mode 100644 static/images/help/light/icon_introduction_3x.png create mode 100644 static/images/help/light/icon_member_3x.png create mode 100644 static/images/help/light/icon_member_relevant_3x.png create mode 100644 static/images/help/light/icon_search_3x.png create mode 100644 static/images/index/light/icon_member_3x.png create mode 100644 static/images/layout/icon_back_3x.png create mode 100644 static/images/layout/icon_tel_3x.png create mode 100644 static/images/layout/img_location_2x.png create mode 100644 static/images/layout/img_rider_3x.png create mode 100644 static/images/member/icon_date_3x.png create mode 100644 static/images/member/icon_difference_3x.png create mode 100644 static/images/member/icon_vip_3x.png create mode 100644 static/images/member/light/img_layer_3x.png create mode 100644 static/images/my/light/icon_aboutus_3x.png create mode 100644 static/images/my/light/icon_address_3x.png create mode 100644 static/images/my/light/icon_edition_3x.png create mode 100644 static/images/my/light/icon_help_3x.png create mode 100644 static/images/my/light/icon_partner_3x.png create mode 100644 static/images/qrcode/ali_qrcode.png create mode 100644 static/images/qrcode/baidu_qrcode.png create mode 100644 static/images/qrcode/h5_qrcode.png create mode 100644 static/images/qrcode/qq_qrcode.jpg create mode 100644 static/images/qrcode/toutiao_qrcode.png create mode 100644 static/images/qrcode/wx_qrcode.jpg create mode 100644 static/images/share/icon_picture_3x.png create mode 100644 static/images/share/icon_share_3x.png create mode 100644 static/images/share/img_bg_3x.png create mode 100644 static/images/tabbar/assembly_default_3x.png create mode 100644 static/images/tabbar/assembly_selected_3x.png create mode 100644 static/images/tabbar/layout_default_3x.png create mode 100644 static/images/tabbar/layout_selected_3x.png create mode 100644 static/images/tabbar/mod_default_3x.png create mode 100644 static/images/tabbar/mod_selected_3x.png create mode 100644 static/images/tabbar/my_default_3x.png create mode 100644 static/images/tabbar/my_selected_3x.png create mode 100644 static/images/website/light/icon_applets_3x.png create mode 100644 static/images/website/light/icon_file_3x.png create mode 100644 static/images/website/light/icon_github_3x.png create mode 100644 static/images/website/light/icon_uni_3x.png create mode 100644 static/images/website/light/icon_website_3x.png create mode 100644 static/json/nodata.json create mode 100644 store/index.js diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6c560a3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +unpackage +/unpackage +/.DS_Store +.DS_Store +node_modules +/node_modules +/.vuepress/dist \ No newline at end of file diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json new file mode 100644 index 0000000..da2a296 --- /dev/null +++ b/.hbuilderx/launch.json @@ -0,0 +1,40 @@ +{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ + // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 + "version": "0.0", + "configurations": [{ + "app-plus" : + { + "launchtype" : "local" + }, + "default" : + { + "launchtype" : "local" + }, + "h5" : + { + "launchtype" : "local" + }, + "mp-alipay" : + { + "launchtype" : "local" + }, + "mp-baidu" : + { + "launchtype" : "local" + }, + "mp-qq" : + { + "launchtype" : "local" + }, + "mp-toutiao" : + { + "launchtype" : "local" + }, + "mp-weixin" : + { + "launchtype" : "local" + }, + "type" : "uniCloud" + } + ] +} diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..2717c07 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +//gitea.thzxcx.com/api/packages/thzxcx/npm/:_authToken=${NPM_CONFIG_TOKEN} diff --git a/App.vue b/App.vue new file mode 100644 index 0000000..c9247ff --- /dev/null +++ b/App.vue @@ -0,0 +1,73 @@ + + + + \ No newline at end of file diff --git a/common/fui-app.css b/common/fui-app.css new file mode 100644 index 0000000..2b93c83 --- /dev/null +++ b/common/fui-app.css @@ -0,0 +1,174 @@ +/* #ifndef APP-NVUE */ +page { + background-color: var(--fui-bg-color-grey, #F1F4FA); + font-size: 32rpx; + font-weight: 500; + color: var(--fui-color-title, #181818); + font-family: -apple-system-font, Helvetica Neue, Helvetica, sans-serif; +} +/* #endif */ + + +.fui-section__title { + font-size: 32rpx; + line-height: 32rpx; + font-weight: 600; + margin-bottom: 32rpx; + padding-left: 16rpx; + position: relative; + /* #ifndef APP-NVUE */ + box-sizing: border-box; + /* #endif */ + /* #ifdef APP-NVUE */ + border-left: 2px solid #465CFF; + /* #endif */ +} +/* #ifndef APP-NVUE */ + +.fui-section__title:not(:first-child) { + margin-top: 96rpx; +} + +.fui-page__title image { + width: 48rpx; + height: 48rpx; + margin-left: 16rpx; + /* #ifdef H5 */ + cursor: pointer; + /* #endif */ +} + +.fui-section__title::after { + content: ''; + position: absolute; + width: 2px; + height: 100%; + background: #465CFF; + border-radius: 2px; + left: 0; + top: 0; +} + +::-webkit-scrollbar { + width: 0 !important; + height: 0 !important; + color: transparent !important; + display: none; +} + +.fui-ellipsis { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; +} + +/* #endif */ + +.fui-vip__icon { + width: 48rpx; + height: 48rpx; + margin-left: 16rpx; + /* #ifdef H5 */ + cursor: pointer; + /* #endif */ +} + +.fui-page__spacing { + padding-left: 32rpx; + padding-right: 32rpx; + /* #ifndef APP-NVUE */ + box-sizing: border-box; + /* #endif */ +} + +.fui-page__hd { + /* #ifndef APP-NVUE */ + width: 100%; + box-sizing: border-box; + /* #endif */ + padding: 52rpx 32rpx; +} + +.fui-page__bd { + /* #ifndef APP-NVUE */ + width: 100%; + /* #endif */ + padding-bottom: 64rpx; +} + + +.fui-page__title { + text-align: left; + font-size: 36rpx; + font-weight: 600; +} + +.fui-page__desc { + margin-top: 8rpx; + color: #B2B2B2; + text-align: left; + font-size: 28rpx; + font-weight: 400; + /* #ifndef APP-NVUE */ + word-break: break-all; + /* #endif */ +} + +.fui-color__primary { + color: #465CFF; +} + +.fui-wrap { + /* #ifndef APP-NVUE */ + width: 100%; + display: flex; + box-sizing: border-box; + /* #endif */ + flex-direction: column; +} + +/*Flex布局*/ +.fui-flex { + /* #ifndef APP-NVUE */ + display: flex; + /* #endif */ + flex-direction: row; +} + +.fui-flex__center { + /* #ifndef APP-NVUE */ + display: flex; + /* #endif */ + flex-direction: row; + align-items: center; + justify-content: center; +} + +.fui-flex__between { + /* #ifndef APP-NVUE */ + display: flex; + /* #endif */ + flex-direction: row; + align-items: center; + justify-content: space-between; +} + +.fui-flex__reverse { + flex-direction: row-reverse; +} + +.fui-align__center { + /* #ifndef APP-NVUE */ + display: flex; + /* #endif */ + align-items: center; + flex-direction: row; +} + +.fui-flex__column { + flex-direction: column !important; +} + +.fui-flex__1 { + flex: 1 +} diff --git a/common/fui-app.js b/common/fui-app.js new file mode 100644 index 0000000..5e48ddb --- /dev/null +++ b/common/fui-app.js @@ -0,0 +1,57 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18614 0 72 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +const fui = { + toast: function(text) { + text && uni.showToast({ + title: text, + icon: 'none', + duration: 2000 + }) + }, + modal: function(title, content, callback, showCancel, confirmColor, confirmText) { + uni.showModal({ + title: title, + content: content, + showCancel: showCancel || false, + // #ifndef MP-TOUTIAO + cancelColor: "#7F7F7F", + confirmColor: confirmColor || "#465CFF", + // #endif + confirmText: confirmText || "确定", + success(res) { + if (res.confirm) { + callback && callback(true) + } else { + callback && callback(false) + } + }, + fail(err){ + console.log(err) + } + }) + }, + href(url, isMain) { + if (isMain) { + uni.switchTab({ + url: url + }) + } else { + uni.navigateTo({ + url: url + }); + } + }, + jsonp: function(url, callback, callbackname) { + // #ifdef H5 + window[callbackname] = callback; + let script = document.createElement("script"); + script.src = url; + script.type = "text/javascript"; + document.head.appendChild(script); + document.head.removeChild(script); + // #endif + }, + resUrl:function(){ + return 'https://res.firstui.cn/static/images' + } +} +export default fui \ No newline at end of file diff --git a/common/fui-request.js b/common/fui-request.js new file mode 100644 index 0000000..2dc03c1 --- /dev/null +++ b/common/fui-request.js @@ -0,0 +1,30 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 86 14 0 725 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import http from '@/components/firstui/fui-request' + +//初始化请求配置项 +http.create({ + host: 'https://ffa.firstui.cn', + header: { + // 'content-type': 'application/x-www-form-urlencoded' + } +}) +//请求拦截 +http.interceptors.request.use(config => { + //请求之前可在请求头中加入token等信息 + let token = uni.getStorageSync('firstui_token') || 'testToken'; + if (config.header) { + config.header['token'] = token + } else { + config.header = { + 'token': token + } + } + return config +}) +//响应拦截 +http.interceptors.response.use(response => { + //TODO + return response +}) + +export default http \ No newline at end of file diff --git a/components/firstui/fui-actionsheet/fui-actionsheet.vue b/components/firstui/fui-actionsheet/fui-actionsheet.vue new file mode 100644 index 0000000..ad9a63c --- /dev/null +++ b/components/firstui/fui-actionsheet/fui-actionsheet.vue @@ -0,0 +1,437 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-alert/fui-alert.vue b/components/firstui/fui-alert/fui-alert.vue new file mode 100644 index 0000000..2b71362 --- /dev/null +++ b/components/firstui/fui-alert/fui-alert.vue @@ -0,0 +1,244 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-animation/fui-animation.vue b/components/firstui/fui-animation/fui-animation.vue new file mode 100644 index 0000000..c6bc3e5 --- /dev/null +++ b/components/firstui/fui-animation/fui-animation.vue @@ -0,0 +1,218 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-autograph/fui-autograph.vue b/components/firstui/fui-autograph/fui-autograph.vue new file mode 100644 index 0000000..f64d4d6 --- /dev/null +++ b/components/firstui/fui-autograph/fui-autograph.vue @@ -0,0 +1,351 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/bridge/bridge-weex.js b/components/firstui/fui-autograph/gcanvas/bridge/bridge-weex.js new file mode 100644 index 0000000..8c5c010 --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/bridge/bridge-weex.js @@ -0,0 +1,242 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1861 4 0 725 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +const isWeex = typeof WXEnvironment !== 'undefined'; +const isWeexIOS = isWeex && /ios/i.test(WXEnvironment.platform); +const isWeexAndroid = isWeex && !isWeexIOS; + +import GLmethod from '../context-webgl/GLmethod'; + +const GCanvasModule = + (typeof weex !== 'undefined' && weex.requireModule) ? (weex.requireModule('gcanvas')) : + (typeof __weex_require__ !== 'undefined') ? (__weex_require__('@weex-module/gcanvas')) : {}; + +let isDebugging = false; + +let isComboDisabled = false; + +const logCommand = (function () { + const methodQuery = []; + Object.keys(GLmethod).forEach(key => { + methodQuery[GLmethod[key]] = key; + }) + const queryMethod = (id) => { + return methodQuery[parseInt(id)] || 'NotFoundMethod'; + } + const logCommand = (id, cmds) => { + const mId = cmds.split(',')[0]; + const mName = queryMethod(mId); + console.log(`=== callNative - componentId:${id}; method: ${mName}; cmds: ${cmds}`); + } + return logCommand; +})(); + +function joinArray(arr, sep) { + let res = ''; + for (let i = 0; i < arr.length; i++) { + if (i !== 0) { + res += sep; + } + res += arr[i]; + } + return res; +} + +const commandsCache = {} + +const GBridge = { + + callEnable: (ref, configArray) => { + + commandsCache[ref] = []; + + return GCanvasModule.enable({ + componentId: ref, + config: configArray + }); + }, + + callEnableDebug: () => { + isDebugging = true; + }, + + callEnableDisableCombo: () => { + isComboDisabled = true; + }, + + callSetContextType: function (componentId, context_type) { + GCanvasModule.setContextType(context_type, componentId); + }, + + callReset: function(id){ + GCanvasModule.resetComponent && canvasModule.resetComponent(componentId); + }, + + render: isWeexIOS ? function (componentId) { + return GCanvasModule.extendCallNative({ + contextId: componentId, + type: 0x60000001 + }); + } : function (componentId) { + return callGCanvasLinkNative(componentId, 0x60000001, 'render'); + }, + + render2d: isWeexIOS ? function (componentId, commands, callback) { + + if (isDebugging) { + console.log('>>> >>> render2d ==='); + console.log('>>> commands: ' + commands); + } + + GCanvasModule.render([commands, callback?true:false], componentId, callback); + + } : function (componentId, commands,callback) { + + if (isDebugging) { + console.log('>>> >>> render2d ==='); + console.log('>>> commands: ' + commands); + } + + callGCanvasLinkNative(componentId, 0x20000001, commands); + if(callback){ + callback(); + } + }, + + callExtendCallNative: isWeexIOS ? function (componentId, cmdArgs) { + + throw 'should not be here anymore ' + cmdArgs; + + } : function (componentId, cmdArgs) { + + throw 'should not be here anymore ' + cmdArgs; + + }, + + + flushNative: isWeexIOS ? function (componentId) { + + const cmdArgs = joinArray(commandsCache[componentId], ';'); + commandsCache[componentId] = []; + + if (isDebugging) { + console.log('>>> >>> flush native ==='); + console.log('>>> commands: ' + cmdArgs); + } + + const result = GCanvasModule.extendCallNative({ + "contextId": componentId, + "type": 0x60000000, + "args": cmdArgs + }); + + const res = result && result.result; + + if (isDebugging) { + console.log('>>> result: ' + res); + } + + return res; + + } : function (componentId) { + + const cmdArgs = joinArray(commandsCache[componentId], ';'); + commandsCache[componentId] = []; + + if (isDebugging) { + console.log('>>> >>> flush native ==='); + console.log('>>> commands: ' + cmdArgs); + } + + const result = callGCanvasLinkNative(componentId, 0x60000000, cmdArgs); + + if (isDebugging) { + console.log('>>> result: ' + result); + } + + return result; + }, + + callNative: function (componentId, cmdArgs, cache) { + + if (isDebugging) { + logCommand(componentId, cmdArgs); + } + + commandsCache[componentId].push(cmdArgs); + + if (!cache || isComboDisabled) { + return GBridge.flushNative(componentId); + } else { + return undefined; + } + }, + + texImage2D(componentId, ...args) { + if (isWeexIOS) { + if (args.length === 6) { + const [target, level, internalformat, format, type, image] = args; + GBridge.callNative( + componentId, + GLmethod.texImage2D + ',' + 6 + ',' + target + ',' + level + ',' + internalformat + ',' + format + ',' + type + ',' + image.src + ) + } else if (args.length === 9) { + const [target, level, internalformat, width, height, border, format, type, image] = args; + GBridge.callNative( + componentId, + GLmethod.texImage2D + ',' + 9 + ',' + target + ',' + level + ',' + internalformat + ',' + width + ',' + height + ',' + border + ',' + + + format + ',' + type + ',' + (image ? image.src : 0) + ) + } + } else if (isWeexAndroid) { + if (args.length === 6) { + const [target, level, internalformat, format, type, image] = args; + GCanvasModule.texImage2D(componentId, target, level, internalformat, format, type, image.src); + } else if (args.length === 9) { + const [target, level, internalformat, width, height, border, format, type, image] = args; + GCanvasModule.texImage2D(componentId, target, level, internalformat, width, height, border, format, type, (image ? image.src : 0)); + } + } + }, + + texSubImage2D(componentId, target, level, xoffset, yoffset, format, type, image) { + if (isWeexIOS) { + if (arguments.length === 8) { + GBridge.callNative( + componentId, + GLmethod.texSubImage2D + ',' + 6 + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset, + ',' + format + ',' + type + ',' + image.src + ) + } + } else if (isWeexAndroid) { + GCanvasModule.texSubImage2D(componentId, target, level, xoffset, yoffset, format, type, image.src); + } + }, + + bindImageTexture(componentId, src, imageId) { + GCanvasModule.bindImageTexture([src, imageId], componentId); + }, + + perloadImage([url, id], callback) { + GCanvasModule.preLoadImage([url, id], function (image) { + image.url = url; + image.id = id; + callback(image); + }); + }, + + measureText(text, fontStyle, componentId) { + return GCanvasModule.measureText([text, fontStyle], componentId); + }, + + getImageData (componentId, x, y, w, h, callback) { + GCanvasModule.getImageData([x, y,w,h],componentId,callback); + }, + + putImageData (componentId, data, x, y, w, h, callback) { + GCanvasModule.putImageData([x, y,w,h,data],componentId,callback); + }, + + toTempFilePath(componentId, x, y, width, height, destWidth, destHeight, fileType, quality, callback){ + GCanvasModule.toTempFilePath([x, y, width,height, destWidth, destHeight, fileType, quality], componentId, callback); + } +} + +export default GBridge; \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/context-2d/FillStyleLinearGradient.js b/components/firstui/fui-autograph/gcanvas/context-2d/FillStyleLinearGradient.js new file mode 100644 index 0000000..d7464d0 --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/context-2d/FillStyleLinearGradient.js @@ -0,0 +1,19 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 861 4 0 7 254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +class FillStyleLinearGradient { + + constructor(x0, y0, x1, y1) { + this._start_pos = { _x: x0, _y: y0 }; + this._end_pos = { _x: x1, _y: y1 }; + this._stop_count = 0; + this._stops = [0, 0, 0, 0, 0]; + } + + addColorStop = function (pos, color) { + if (this._stop_count < 5 && 0.0 <= pos && pos <= 1.0) { + this._stops[this._stop_count] = { _pos: pos, _color: color }; + this._stop_count++; + } + } +} + +export default FillStyleLinearGradient; \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/context-2d/FillStylePattern.js b/components/firstui/fui-autograph/gcanvas/context-2d/FillStylePattern.js new file mode 100644 index 0000000..7c76269 --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/context-2d/FillStylePattern.js @@ -0,0 +1,9 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:186 140 725 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +class FillStylePattern { + constructor(img, pattern) { + this._style = pattern; + this._img = img; + } +} + +export default FillStylePattern; \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/context-2d/FillStyleRadialGradient.js b/components/firstui/fui-autograph/gcanvas/context-2d/FillStyleRadialGradient.js new file mode 100644 index 0000000..b9a0c95 --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/context-2d/FillStyleRadialGradient.js @@ -0,0 +1,18 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 6140 7 254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +class FillStyleRadialGradient { + constructor(x0, y0, r0, x1, y1, r1) { + this._start_pos = { _x: x0, _y: y0, _r: r0 }; + this._end_pos = { _x: x1, _y: y1, _r: r1 }; + this._stop_count = 0; + this._stops = [0, 0, 0, 0, 0]; + } + + addColorStop(pos, color) { + if (this._stop_count < 5 && 0.0 <= pos && pos <= 1.0) { + this._stops[this._stop_count] = { _pos: pos, _color: color }; + this._stop_count++; + } + } +} + +export default FillStyleRadialGradient; \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/context-2d/RenderingContext.js b/components/firstui/fui-autograph/gcanvas/context-2d/RenderingContext.js new file mode 100644 index 0000000..95865e9 --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/context-2d/RenderingContext.js @@ -0,0 +1,667 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 186 1 4 072 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import FillStylePattern from './FillStylePattern'; +import FillStyleLinearGradient from './FillStyleLinearGradient'; +import FillStyleRadialGradient from './FillStyleRadialGradient'; +import GImage from '../env/image.js'; +import { + ArrayBufferToBase64, + Base64ToUint8ClampedArray +} from '../env/tool.js'; + +export default class CanvasRenderingContext2D { + + _drawCommands = ''; + + _globalAlpha = 1.0; + + _fillStyle = 'rgb(0,0,0)'; + _strokeStyle = 'rgb(0,0,0)'; + + _lineWidth = 1; + _lineCap = 'butt'; + _lineJoin = 'miter'; + + _miterLimit = 10; + + _globalCompositeOperation = 'source-over'; + + _textAlign = 'start'; + _textBaseline = 'alphabetic'; + + _font = '10px sans-serif'; + + _savedGlobalAlpha = []; + + timer = null; + componentId = null; + + _notCommitDrawImageCache = []; + _needRedrawImageCache = []; + _redrawCommands = ''; + _autoSaveContext = true; + // _imageMap = new GHashMap(); + // _textureMap = new GHashMap(); + + constructor() { + this.className = 'CanvasRenderingContext2D'; + //this.save() + } + + setFillStyle(value) { + this.fillStyle = value; + } + + set fillStyle(value) { + this._fillStyle = value; + + if (typeof(value) == 'string') { + this._drawCommands = this._drawCommands.concat("F" + value + ";"); + } else if (value instanceof FillStylePattern) { + const image = value._img; + if (!image.complete) { + image.onload = () => { + var index = this._needRedrawImageCache.indexOf(image); + if (index > -1) { + this._needRedrawImageCache.splice(index, 1); + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + this._redrawflush(true); + } + } + this._notCommitDrawImageCache.push(image); + } else { + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + } + + //CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + this._drawCommands = this._drawCommands.concat("G" + image._id + "," + value._style + ";"); + } else if (value instanceof FillStyleLinearGradient) { + var command = "D" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + + value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," + + value._stop_count; + for (var i = 0; i < value._stop_count; ++i) { + command += ("," + value._stops[i]._pos + "," + value._stops[i]._color); + } + this._drawCommands = this._drawCommands.concat(command + ";"); + } else if (value instanceof FillStyleRadialGradient) { + var command = "H" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + value._start_pos._r + .toFixed(2) + "," + + value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," + value._end_pos._r.toFixed(2) + "," + + value._stop_count; + for (var i = 0; i < value._stop_count; ++i) { + command += ("," + value._stops[i]._pos + "," + value._stops[i]._color); + } + this._drawCommands = this._drawCommands.concat(command + ";"); + } + } + + get fillStyle() { + return this._fillStyle; + } + + get globalAlpha() { + return this._globalAlpha; + } + + setGlobalAlpha(value) { + this.globalAlpha = value; + } + + set globalAlpha(value) { + this._globalAlpha = value; + this._drawCommands = this._drawCommands.concat("a" + value.toFixed(2) + ";"); + } + + + get strokeStyle() { + return this._strokeStyle; + } + + setStrokeStyle(value) { + this.strokeStyle = value; + } + + set strokeStyle(value) { + + this._strokeStyle = value; + + if (typeof(value) == 'string') { + this._drawCommands = this._drawCommands.concat("S" + value + ";"); + } else if (value instanceof FillStylePattern) { + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + this._drawCommands = this._drawCommands.concat("G" + image._id + "," + value._style + ";"); + } else if (value instanceof FillStyleLinearGradient) { + var command = "D" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + + value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," + + value._stop_count; + + for (var i = 0; i < value._stop_count; ++i) { + command += ("," + value._stops[i]._pos + "," + value._stops[i]._color); + } + this._drawCommands = this._drawCommands.concat(command + ";"); + } else if (value instanceof FillStyleRadialGradient) { + var command = "H" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + value._start_pos._r + .toFixed(2) + "," + + value._end_pos._x.toFixed(2) + "," + value._end_pos._y + ",".toFixed(2) + value._end_pos._r.toFixed(2) + "," + + value._stop_count; + + for (var i = 0; i < value._stop_count; ++i) { + command += ("," + value._stops[i]._pos + "," + value._stops[i]._color); + } + this._drawCommands = this._drawCommands.concat(command + ";"); + } + } + + get lineWidth() { + return this._lineWidth; + } + + setLineWidth(value) { + this.lineWidth = value; + } + + set lineWidth(value) { + this._lineWidth = value; + this._drawCommands = this._drawCommands.concat("W" + value + ";"); + } + + get lineCap() { + return this._lineCap; + } + + setLineCap(value) { + this.lineCap = value; + } + + set lineCap(value) { + this._lineCap = value; + this._drawCommands = this._drawCommands.concat("C" + value + ";"); + } + + get lineJoin() { + return this._lineJoin; + } + + setLineJoin(value) { + this.lineJoin = value + } + + set lineJoin(value) { + this._lineJoin = value; + this._drawCommands = this._drawCommands.concat("J" + value + ";"); + } + + get miterLimit() { + return this._miterLimit; + } + + setMiterLimit(value) { + this.miterLimit = value + } + + set miterLimit(value) { + this._miterLimit = value; + this._drawCommands = this._drawCommands.concat("M" + value + ";"); + } + + get globalCompositeOperation() { + return this._globalCompositeOperation; + } + + set globalCompositeOperation(value) { + + this._globalCompositeOperation = value; + let mode = 0; + switch (value) { + case "source-over": + mode = 0; + break; + case "source-atop": + mode = 5; + break; + case "source-in": + mode = 0; + break; + case "source-out": + mode = 2; + break; + case "destination-over": + mode = 4; + break; + case "destination-atop": + mode = 4; + break; + case "destination-in": + mode = 4; + break; + case "destination-out": + mode = 3; + break; + case "lighter": + mode = 1; + break; + case "copy": + mode = 2; + break; + case "xor": + mode = 6; + break; + default: + mode = 0; + } + + this._drawCommands = this._drawCommands.concat("B" + mode + ";"); + } + + get textAlign() { + return this._textAlign; + } + + setTextAlign(value) { + this.textAlign = value + } + + set textAlign(value) { + + this._textAlign = value; + let Align = 0; + switch (value) { + case "start": + Align = 0; + break; + case "end": + Align = 1; + break; + case "left": + Align = 2; + break; + case "center": + Align = 3; + break; + case "right": + Align = 4; + break; + default: + Align = 0; + } + + this._drawCommands = this._drawCommands.concat("A" + Align + ";"); + } + + get textBaseline() { + return this._textBaseline; + } + + setTextBaseline(value) { + this.textBaseline = value + } + + set textBaseline(value) { + this._textBaseline = value; + let baseline = 0; + switch (value) { + case "alphabetic": + baseline = 0; + break; + case "middle": + baseline = 1; + break; + case "top": + baseline = 2; + break; + case "hanging": + baseline = 3; + break; + case "bottom": + baseline = 4; + break; + case "ideographic": + baseline = 5; + break; + default: + baseline = 0; + break; + } + + this._drawCommands = this._drawCommands.concat("E" + baseline + ";"); + } + + get font() { + return this._font; + } + + setFontSize(size) { + var str = this._font; + var strs = str.trim().split(/\s+/); + for (var i = 0; i < strs.length; i++) { + var values = ["normal", "italic", "oblique", "normal", "small-caps", "normal", "bold", + "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900", + "normal", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", + "semi-expanded", "expanded", "extra-expanded", "ultra-expanded" + ]; + + if (-1 == values.indexOf(strs[i].trim())) { + if (typeof size === 'string') { + strs[i] = size; + } else if (typeof size === 'number') { + strs[i] = String(size) + 'px'; + } + break; + } + } + this.font = strs.join(" "); + } + + set font(value) { + this._font = value; + this._drawCommands = this._drawCommands.concat("j" + value + ";"); + } + + setTransform(a, b, c, d, tx, ty) { + this._drawCommands = this._drawCommands.concat("t" + + (a === 1 ? "1" : a.toFixed(2)) + "," + + (b === 0 ? "0" : b.toFixed(2)) + "," + + (c === 0 ? "0" : c.toFixed(2)) + "," + + (d === 1 ? "1" : d.toFixed(2)) + "," + tx.toFixed(2) + "," + ty.toFixed(2) + ";"); + } + + transform(a, b, c, d, tx, ty) { + this._drawCommands = this._drawCommands.concat("f" + + (a === 1 ? "1" : a.toFixed(2)) + "," + + (b === 0 ? "0" : b.toFixed(2)) + "," + + (c === 0 ? "0" : c.toFixed(2)) + "," + + (d === 1 ? "1" : d.toFixed(2)) + "," + tx + "," + ty + ";"); + } + + resetTransform() { + this._drawCommands = this._drawCommands.concat("m;"); + } + + scale(a, d) { + this._drawCommands = this._drawCommands.concat("k" + a.toFixed(2) + "," + + d.toFixed(2) + ";"); + } + + rotate(angle) { + this._drawCommands = this._drawCommands + .concat("r" + angle.toFixed(6) + ";"); + } + + translate(tx, ty) { + this._drawCommands = this._drawCommands.concat("l" + tx.toFixed(2) + "," + ty.toFixed(2) + ";"); + } + + save() { + this._savedGlobalAlpha.push(this._globalAlpha); + this._drawCommands = this._drawCommands.concat("v;"); + } + + restore() { + this._drawCommands = this._drawCommands.concat("e;"); + this._globalAlpha = this._savedGlobalAlpha.pop(); + } + + createPattern(img, pattern) { + if (typeof img === 'string') { + var imgObj = new GImage(); + imgObj.src = img; + img = imgObj; + } + return new FillStylePattern(img, pattern); + } + + createLinearGradient(x0, y0, x1, y1) { + return new FillStyleLinearGradient(x0, y0, x1, y1); + } + + createRadialGradient = function(x0, y0, r0, x1, y1, r1) { + return new FillStyleRadialGradient(x0, y0, r0, x1, y1, r1); + }; + + createCircularGradient = function(x0, y0, r0) { + return new FillStyleRadialGradient(x0, y0, 0, x0, y0, r0); + }; + + strokeRect(x, y, w, h) { + this._drawCommands = this._drawCommands.concat("s" + x + "," + y + "," + w + "," + h + ";"); + } + + + clearRect(x, y, w, h) { + this._drawCommands = this._drawCommands.concat("c" + x + "," + y + "," + w + + "," + h + ";"); + } + + clip() { + this._drawCommands = this._drawCommands.concat("p;"); + } + + resetClip() { + this._drawCommands = this._drawCommands.concat("q;"); + } + + closePath() { + this._drawCommands = this._drawCommands.concat("o;"); + } + + moveTo(x, y) { + this._drawCommands = this._drawCommands.concat("g" + x.toFixed(2) + "," + y.toFixed(2) + ";"); + } + + lineTo(x, y) { + this._drawCommands = this._drawCommands.concat("i" + x.toFixed(2) + "," + y.toFixed(2) + ";"); + } + + quadraticCurveTo = function(cpx, cpy, x, y) { + this._drawCommands = this._drawCommands.concat("u" + cpx + "," + cpy + "," + x + "," + y + ";"); + } + + bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, ) { + this._drawCommands = this._drawCommands.concat( + "z" + cp1x.toFixed(2) + "," + cp1y.toFixed(2) + "," + cp2x.toFixed(2) + "," + cp2y.toFixed(2) + "," + + x.toFixed(2) + "," + y.toFixed(2) + ";"); + } + + arcTo(x1, y1, x2, y2, radius) { + this._drawCommands = this._drawCommands.concat("h" + x1 + "," + y1 + "," + x2 + "," + y2 + "," + radius + ";"); + } + + beginPath() { + this._drawCommands = this._drawCommands.concat("b;"); + } + + + fillRect(x, y, w, h) { + this._drawCommands = this._drawCommands.concat("n" + x + "," + y + "," + w + + "," + h + ";"); + } + + rect(x, y, w, h) { + this._drawCommands = this._drawCommands.concat("w" + x + "," + y + "," + w + "," + h + ";"); + } + + fill() { + this._drawCommands = this._drawCommands.concat("L;"); + } + + stroke(path) { + this._drawCommands = this._drawCommands.concat("x;"); + } + + arc(x, y, radius, startAngle, endAngle, anticlockwise) { + + let ianticlockwise = 0; + if (anticlockwise) { + ianticlockwise = 1; + } + + this._drawCommands = this._drawCommands.concat( + "y" + x.toFixed(2) + "," + y.toFixed(2) + "," + + radius.toFixed(2) + "," + startAngle + "," + endAngle + "," + ianticlockwise + + ";" + ); + } + + fillText(text, x, y) { + let tmptext = text.replace(/!/g, "!!"); + tmptext = tmptext.replace(/,/g, "!,"); + tmptext = tmptext.replace(/;/g, "!;"); + this._drawCommands = this._drawCommands.concat("T" + tmptext + "," + x + "," + y + ",0.0;"); + } + + strokeText = function(text, x, y) { + let tmptext = text.replace(/!/g, "!!"); + tmptext = tmptext.replace(/,/g, "!,"); + tmptext = tmptext.replace(/;/g, "!;"); + this._drawCommands = this._drawCommands.concat("U" + tmptext + "," + x + "," + y + ",0.0;"); + } + + measureText(text) { + return CanvasRenderingContext2D.GBridge.measureText(text, this.font, this.componentId); + } + + isPointInPath = function(x, y) { + throw new Error('GCanvas not supported yet'); + } + + drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) { + if (typeof image === 'string') { + var imgObj = new GImage(); + imgObj.src = image; + image = imgObj; + } + if (image instanceof GImage) { + if (!image.complete) { + imgObj.onload = () => { + var index = this._needRedrawImageCache.indexOf(image); + if (index > -1) { + this._needRedrawImageCache.splice(index, 1); + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + this._redrawflush(true); + } + } + this._notCommitDrawImageCache.push(image); + } else { + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + } + var srcArgs = [image, sx, sy, sw, sh, dx, dy, dw, dh]; + var args = []; + for (var arg in srcArgs) { + if (typeof(srcArgs[arg]) != 'undefined') { + args.push(srcArgs[arg]); + } + } + this.__drawImage.apply(this, args); + //this.__drawImage(image,sx, sy, sw, sh, dx, dy, dw, dh); + } + } + + __drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) { + const numArgs = arguments.length; + + function drawImageCommands() { + + if (numArgs === 3) { + const x = parseFloat(sx) || 0.0; + const y = parseFloat(sy) || 0.0; + + return ("d" + image._id + ",0,0," + + image.width + "," + image.height + "," + + x + "," + y + "," + image.width + "," + image.height + ";"); + } else if (numArgs === 5) { + const x = parseFloat(sx) || 0.0; + const y = parseFloat(sy) || 0.0; + const width = parseInt(sw) || image.width; + const height = parseInt(sh) || image.height; + + return ("d" + image._id + ",0,0," + + image.width + "," + image.height + "," + + x + "," + y + "," + width + "," + height + ";"); + } else if (numArgs === 9) { + sx = parseFloat(sx) || 0.0; + sy = parseFloat(sy) || 0.0; + sw = parseInt(sw) || image.width; + sh = parseInt(sh) || image.height; + dx = parseFloat(dx) || 0.0; + dy = parseFloat(dy) || 0.0; + dw = parseInt(dw) || image.width; + dh = parseInt(dh) || image.height; + + return ("d" + image._id + "," + + sx + "," + sy + "," + sw + "," + sh + "," + + dx + "," + dy + "," + dw + "," + dh + ";"); + } + } + this._drawCommands += drawImageCommands(); + } + + _flush(reserve, callback) { + const commands = this._drawCommands; + this._drawCommands = ''; + CanvasRenderingContext2D.GBridge.render2d(this.componentId, commands, callback); + this._needRender = false; + } + + _redrawflush(reserve, callback) { + const commands = this._redrawCommands; + CanvasRenderingContext2D.GBridge.render2d(this.componentId, commands, callback); + if (this._needRedrawImageCache.length == 0) { + this._redrawCommands = ''; + } + } + + draw(reserve, callback) { + if (!reserve) { + this._globalAlpha = this._savedGlobalAlpha.pop(); + this._savedGlobalAlpha.push(this._globalAlpha); + this._redrawCommands = this._drawCommands; + this._needRedrawImageCache = this._notCommitDrawImageCache; + if (this._autoSaveContext) { + this._drawCommands = ("v;" + this._drawCommands); + this._autoSaveContext = false; + } else { + this._drawCommands = ("e;X;v;" + this._drawCommands); + } + } else { + this._needRedrawImageCache = this._needRedrawImageCache.concat(this._notCommitDrawImageCache); + this._redrawCommands += this._drawCommands; + if (this._autoSaveContext) { + this._drawCommands = ("v;" + this._drawCommands); + this._autoSaveContext = false; + } + } + this._notCommitDrawImageCache = []; + if (this._flush) { + this._flush(reserve, callback); + } + } + + getImageData(x, y, w, h, callback) { + CanvasRenderingContext2D.GBridge.getImageData(this.componentId, x, y, w, h, function(res) { + res.data = Base64ToUint8ClampedArray(res.data); + if (typeof(callback) == 'function') { + callback(res); + } + }); + } + + putImageData(data, x, y, w, h, callback) { + if (data instanceof Uint8ClampedArray) { + data = ArrayBufferToBase64(data); + CanvasRenderingContext2D.GBridge.putImageData(this.componentId, data, x, y, w, h, function(res) { + if (typeof(callback) == 'function') { + callback(res); + } + }); + } + } + + toTempFilePath(x, y, width, height, destWidth, destHeight, fileType, quality, callback) { + CanvasRenderingContext2D.GBridge.toTempFilePath(this.componentId, x, y, width, height, destWidth, destHeight, + fileType, quality, + function(res) { + if (typeof(callback) == 'function') { + callback(res); + } + }); + } +} \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/context-webgl/ActiveInfo.js b/components/firstui/fui-autograph/gcanvas/context-webgl/ActiveInfo.js new file mode 100644 index 0000000..89b0fe9 --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/context-webgl/ActiveInfo.js @@ -0,0 +1,12 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 6 1 407 25 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +export default class WebGLActiveInfo { + className = 'WebGLActiveInfo'; + + constructor({ + type, name, size + }) { + this.type = type; + this.name = name; + this.size = size; + } +} \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/context-webgl/Buffer.js b/components/firstui/fui-autograph/gcanvas/context-webgl/Buffer.js new file mode 100644 index 0000000..f092171 --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/context-webgl/Buffer.js @@ -0,0 +1,22 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 61 407 2549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLBuffer'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLBuffer { + className = name; + + constructor(id) { + this.id = id; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/context-webgl/Framebuffer.js b/components/firstui/fui-autograph/gcanvas/context-webgl/Framebuffer.js new file mode 100644 index 0000000..c211e60 --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/context-webgl/Framebuffer.js @@ -0,0 +1,22 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 61 4 0725 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLFrameBuffer'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLFramebuffer { + className = name; + + constructor(id) { + this.id = id; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/context-webgl/GLenum.js b/components/firstui/fui-autograph/gcanvas/context-webgl/GLenum.js new file mode 100644 index 0000000..cd13d5a --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/context-webgl/GLenum.js @@ -0,0 +1,299 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 61 40 72 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +export default { + "DEPTH_BUFFER_BIT": 256, + "STENCIL_BUFFER_BIT": 1024, + "COLOR_BUFFER_BIT": 16384, + "POINTS": 0, + "LINES": 1, + "LINE_LOOP": 2, + "LINE_STRIP": 3, + "TRIANGLES": 4, + "TRIANGLE_STRIP": 5, + "TRIANGLE_FAN": 6, + "ZERO": 0, + "ONE": 1, + "SRC_COLOR": 768, + "ONE_MINUS_SRC_COLOR": 769, + "SRC_ALPHA": 770, + "ONE_MINUS_SRC_ALPHA": 771, + "DST_ALPHA": 772, + "ONE_MINUS_DST_ALPHA": 773, + "DST_COLOR": 774, + "ONE_MINUS_DST_COLOR": 775, + "SRC_ALPHA_SATURATE": 776, + "FUNC_ADD": 32774, + "BLEND_EQUATION": 32777, + "BLEND_EQUATION_RGB": 32777, + "BLEND_EQUATION_ALPHA": 34877, + "FUNC_SUBTRACT": 32778, + "FUNC_REVERSE_SUBTRACT": 32779, + "BLEND_DST_RGB": 32968, + "BLEND_SRC_RGB": 32969, + "BLEND_DST_ALPHA": 32970, + "BLEND_SRC_ALPHA": 32971, + "CONSTANT_COLOR": 32769, + "ONE_MINUS_CONSTANT_COLOR": 32770, + "CONSTANT_ALPHA": 32771, + "ONE_MINUS_CONSTANT_ALPHA": 32772, + "BLEND_COLOR": 32773, + "ARRAY_BUFFER": 34962, + "ELEMENT_ARRAY_BUFFER": 34963, + "ARRAY_BUFFER_BINDING": 34964, + "ELEMENT_ARRAY_BUFFER_BINDING": 34965, + "STREAM_DRAW": 35040, + "STATIC_DRAW": 35044, + "DYNAMIC_DRAW": 35048, + "BUFFER_SIZE": 34660, + "BUFFER_USAGE": 34661, + "CURRENT_VERTEX_ATTRIB": 34342, + "FRONT": 1028, + "BACK": 1029, + "FRONT_AND_BACK": 1032, + "TEXTURE_2D": 3553, + "CULL_FACE": 2884, + "BLEND": 3042, + "DITHER": 3024, + "STENCIL_TEST": 2960, + "DEPTH_TEST": 2929, + "SCISSOR_TEST": 3089, + "POLYGON_OFFSET_FILL": 32823, + "SAMPLE_ALPHA_TO_COVERAGE": 32926, + "SAMPLE_COVERAGE": 32928, + "NO_ERROR": 0, + "INVALID_ENUM": 1280, + "INVALID_VALUE": 1281, + "INVALID_OPERATION": 1282, + "OUT_OF_MEMORY": 1285, + "CW": 2304, + "CCW": 2305, + "LINE_WIDTH": 2849, + "ALIASED_POINT_SIZE_RANGE": 33901, + "ALIASED_LINE_WIDTH_RANGE": 33902, + "CULL_FACE_MODE": 2885, + "FRONT_FACE": 2886, + "DEPTH_RANGE": 2928, + "DEPTH_WRITEMASK": 2930, + "DEPTH_CLEAR_VALUE": 2931, + "DEPTH_FUNC": 2932, + "STENCIL_CLEAR_VALUE": 2961, + "STENCIL_FUNC": 2962, + "STENCIL_FAIL": 2964, + "STENCIL_PASS_DEPTH_FAIL": 2965, + "STENCIL_PASS_DEPTH_PASS": 2966, + "STENCIL_REF": 2967, + "STENCIL_VALUE_MASK": 2963, + "STENCIL_WRITEMASK": 2968, + "STENCIL_BACK_FUNC": 34816, + "STENCIL_BACK_FAIL": 34817, + "STENCIL_BACK_PASS_DEPTH_FAIL": 34818, + "STENCIL_BACK_PASS_DEPTH_PASS": 34819, + "STENCIL_BACK_REF": 36003, + "STENCIL_BACK_VALUE_MASK": 36004, + "STENCIL_BACK_WRITEMASK": 36005, + "VIEWPORT": 2978, + "SCISSOR_BOX": 3088, + "COLOR_CLEAR_VALUE": 3106, + "COLOR_WRITEMASK": 3107, + "UNPACK_ALIGNMENT": 3317, + "PACK_ALIGNMENT": 3333, + "MAX_TEXTURE_SIZE": 3379, + "MAX_VIEWPORT_DIMS": 3386, + "SUBPIXEL_BITS": 3408, + "RED_BITS": 3410, + "GREEN_BITS": 3411, + "BLUE_BITS": 3412, + "ALPHA_BITS": 3413, + "DEPTH_BITS": 3414, + "STENCIL_BITS": 3415, + "POLYGON_OFFSET_UNITS": 10752, + "POLYGON_OFFSET_FACTOR": 32824, + "TEXTURE_BINDING_2D": 32873, + "SAMPLE_BUFFERS": 32936, + "SAMPLES": 32937, + "SAMPLE_COVERAGE_VALUE": 32938, + "SAMPLE_COVERAGE_INVERT": 32939, + "COMPRESSED_TEXTURE_FORMATS": 34467, + "DONT_CARE": 4352, + "FASTEST": 4353, + "NICEST": 4354, + "GENERATE_MIPMAP_HINT": 33170, + "BYTE": 5120, + "UNSIGNED_BYTE": 5121, + "SHORT": 5122, + "UNSIGNED_SHORT": 5123, + "INT": 5124, + "UNSIGNED_INT": 5125, + "FLOAT": 5126, + "DEPTH_COMPONENT": 6402, + "ALPHA": 6406, + "RGB": 6407, + "RGBA": 6408, + "LUMINANCE": 6409, + "LUMINANCE_ALPHA": 6410, + "UNSIGNED_SHORT_4_4_4_4": 32819, + "UNSIGNED_SHORT_5_5_5_1": 32820, + "UNSIGNED_SHORT_5_6_5": 33635, + "FRAGMENT_SHADER": 35632, + "VERTEX_SHADER": 35633, + "MAX_VERTEX_ATTRIBS": 34921, + "MAX_VERTEX_UNIFORM_VECTORS": 36347, + "MAX_VARYING_VECTORS": 36348, + "MAX_COMBINED_TEXTURE_IMAGE_UNITS": 35661, + "MAX_VERTEX_TEXTURE_IMAGE_UNITS": 35660, + "MAX_TEXTURE_IMAGE_UNITS": 34930, + "MAX_FRAGMENT_UNIFORM_VECTORS": 36349, + "SHADER_TYPE": 35663, + "DELETE_STATUS": 35712, + "LINK_STATUS": 35714, + "VALIDATE_STATUS": 35715, + "ATTACHED_SHADERS": 35717, + "ACTIVE_UNIFORMS": 35718, + "ACTIVE_ATTRIBUTES": 35721, + "SHADING_LANGUAGE_VERSION": 35724, + "CURRENT_PROGRAM": 35725, + "NEVER": 512, + "LESS": 513, + "EQUAL": 514, + "LEQUAL": 515, + "GREATER": 516, + "NOTEQUAL": 517, + "GEQUAL": 518, + "ALWAYS": 519, + "KEEP": 7680, + "REPLACE": 7681, + "INCR": 7682, + "DECR": 7683, + "INVERT": 5386, + "INCR_WRAP": 34055, + "DECR_WRAP": 34056, + "VENDOR": 7936, + "RENDERER": 7937, + "VERSION": 7938, + "NEAREST": 9728, + "LINEAR": 9729, + "NEAREST_MIPMAP_NEAREST": 9984, + "LINEAR_MIPMAP_NEAREST": 9985, + "NEAREST_MIPMAP_LINEAR": 9986, + "LINEAR_MIPMAP_LINEAR": 9987, + "TEXTURE_MAG_FILTER": 10240, + "TEXTURE_MIN_FILTER": 10241, + "TEXTURE_WRAP_S": 10242, + "TEXTURE_WRAP_T": 10243, + "TEXTURE": 5890, + "TEXTURE_CUBE_MAP": 34067, + "TEXTURE_BINDING_CUBE_MAP": 34068, + "TEXTURE_CUBE_MAP_POSITIVE_X": 34069, + "TEXTURE_CUBE_MAP_NEGATIVE_X": 34070, + "TEXTURE_CUBE_MAP_POSITIVE_Y": 34071, + "TEXTURE_CUBE_MAP_NEGATIVE_Y": 34072, + "TEXTURE_CUBE_MAP_POSITIVE_Z": 34073, + "TEXTURE_CUBE_MAP_NEGATIVE_Z": 34074, + "MAX_CUBE_MAP_TEXTURE_SIZE": 34076, + "TEXTURE0": 33984, + "TEXTURE1": 33985, + "TEXTURE2": 33986, + "TEXTURE3": 33987, + "TEXTURE4": 33988, + "TEXTURE5": 33989, + "TEXTURE6": 33990, + "TEXTURE7": 33991, + "TEXTURE8": 33992, + "TEXTURE9": 33993, + "TEXTURE10": 33994, + "TEXTURE11": 33995, + "TEXTURE12": 33996, + "TEXTURE13": 33997, + "TEXTURE14": 33998, + "TEXTURE15": 33999, + "TEXTURE16": 34000, + "TEXTURE17": 34001, + "TEXTURE18": 34002, + "TEXTURE19": 34003, + "TEXTURE20": 34004, + "TEXTURE21": 34005, + "TEXTURE22": 34006, + "TEXTURE23": 34007, + "TEXTURE24": 34008, + "TEXTURE25": 34009, + "TEXTURE26": 34010, + "TEXTURE27": 34011, + "TEXTURE28": 34012, + "TEXTURE29": 34013, + "TEXTURE30": 34014, + "TEXTURE31": 34015, + "ACTIVE_TEXTURE": 34016, + "REPEAT": 10497, + "CLAMP_TO_EDGE": 33071, + "MIRRORED_REPEAT": 33648, + "FLOAT_VEC2": 35664, + "FLOAT_VEC3": 35665, + "FLOAT_VEC4": 35666, + "INT_VEC2": 35667, + "INT_VEC3": 35668, + "INT_VEC4": 35669, + "BOOL": 35670, + "BOOL_VEC2": 35671, + "BOOL_VEC3": 35672, + "BOOL_VEC4": 35673, + "FLOAT_MAT2": 35674, + "FLOAT_MAT3": 35675, + "FLOAT_MAT4": 35676, + "SAMPLER_2D": 35678, + "SAMPLER_CUBE": 35680, + "VERTEX_ATTRIB_ARRAY_ENABLED": 34338, + "VERTEX_ATTRIB_ARRAY_SIZE": 34339, + "VERTEX_ATTRIB_ARRAY_STRIDE": 34340, + "VERTEX_ATTRIB_ARRAY_TYPE": 34341, + "VERTEX_ATTRIB_ARRAY_NORMALIZED": 34922, + "VERTEX_ATTRIB_ARRAY_POINTER": 34373, + "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING": 34975, + "IMPLEMENTATION_COLOR_READ_TYPE": 35738, + "IMPLEMENTATION_COLOR_READ_FORMAT": 35739, + "COMPILE_STATUS": 35713, + "LOW_FLOAT": 36336, + "MEDIUM_FLOAT": 36337, + "HIGH_FLOAT": 36338, + "LOW_INT": 36339, + "MEDIUM_INT": 36340, + "HIGH_INT": 36341, + "FRAMEBUFFER": 36160, + "RENDERBUFFER": 36161, + "RGBA4": 32854, + "RGB5_A1": 32855, + "RGB565": 36194, + "DEPTH_COMPONENT16": 33189, + "STENCIL_INDEX8": 36168, + "DEPTH_STENCIL": 34041, + "RENDERBUFFER_WIDTH": 36162, + "RENDERBUFFER_HEIGHT": 36163, + "RENDERBUFFER_INTERNAL_FORMAT": 36164, + "RENDERBUFFER_RED_SIZE": 36176, + "RENDERBUFFER_GREEN_SIZE": 36177, + "RENDERBUFFER_BLUE_SIZE": 36178, + "RENDERBUFFER_ALPHA_SIZE": 36179, + "RENDERBUFFER_DEPTH_SIZE": 36180, + "RENDERBUFFER_STENCIL_SIZE": 36181, + "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE": 36048, + "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME": 36049, + "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL": 36050, + "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE": 36051, + "COLOR_ATTACHMENT0": 36064, + "DEPTH_ATTACHMENT": 36096, + "STENCIL_ATTACHMENT": 36128, + "DEPTH_STENCIL_ATTACHMENT": 33306, + "NONE": 0, + "FRAMEBUFFER_COMPLETE": 36053, + "FRAMEBUFFER_INCOMPLETE_ATTACHMENT": 36054, + "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT": 36055, + "FRAMEBUFFER_INCOMPLETE_DIMENSIONS": 36057, + "FRAMEBUFFER_UNSUPPORTED": 36061, + "FRAMEBUFFER_BINDING": 36006, + "RENDERBUFFER_BINDING": 36007, + "MAX_RENDERBUFFER_SIZE": 34024, + "INVALID_FRAMEBUFFER_OPERATION": 1286, + "UNPACK_FLIP_Y_WEBGL": 37440, + "UNPACK_PREMULTIPLY_ALPHA_WEBGL": 37441, + "CONTEXT_LOST_WEBGL": 37442, + "UNPACK_COLORSPACE_CONVERSION_WEBGL": 37443, + "BROWSER_DEFAULT_WEBGL": 37444 +}; \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/context-webgl/GLmethod.js b/components/firstui/fui-autograph/gcanvas/context-webgl/GLmethod.js new file mode 100644 index 0000000..86a7b3e --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/context-webgl/GLmethod.js @@ -0,0 +1,143 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:186 140 7 254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +let i = 1; + +const GLmethod = {}; + +GLmethod.activeTexture = i++; //1 +GLmethod.attachShader = i++; +GLmethod.bindAttribLocation = i++; +GLmethod.bindBuffer = i++; +GLmethod.bindFramebuffer = i++; +GLmethod.bindRenderbuffer = i++; +GLmethod.bindTexture = i++; +GLmethod.blendColor = i++; +GLmethod.blendEquation = i++; +GLmethod.blendEquationSeparate = i++; //10 +GLmethod.blendFunc = i++; +GLmethod.blendFuncSeparate = i++; +GLmethod.bufferData = i++; +GLmethod.bufferSubData = i++; +GLmethod.checkFramebufferStatus = i++; +GLmethod.clear = i++; +GLmethod.clearColor = i++; +GLmethod.clearDepth = i++; +GLmethod.clearStencil = i++; +GLmethod.colorMask = i++; //20 +GLmethod.compileShader = i++; +GLmethod.compressedTexImage2D = i++; +GLmethod.compressedTexSubImage2D = i++; +GLmethod.copyTexImage2D = i++; +GLmethod.copyTexSubImage2D = i++; +GLmethod.createBuffer = i++; +GLmethod.createFramebuffer = i++; +GLmethod.createProgram = i++; +GLmethod.createRenderbuffer = i++; +GLmethod.createShader = i++; //30 +GLmethod.createTexture = i++; +GLmethod.cullFace = i++; +GLmethod.deleteBuffer = i++; +GLmethod.deleteFramebuffer = i++; +GLmethod.deleteProgram = i++; +GLmethod.deleteRenderbuffer = i++; +GLmethod.deleteShader = i++; +GLmethod.deleteTexture = i++; +GLmethod.depthFunc = i++; +GLmethod.depthMask = i++; //40 +GLmethod.depthRange = i++; +GLmethod.detachShader = i++; +GLmethod.disable = i++; +GLmethod.disableVertexAttribArray = i++; +GLmethod.drawArrays = i++; +GLmethod.drawArraysInstancedANGLE = i++; +GLmethod.drawElements = i++; +GLmethod.drawElementsInstancedANGLE = i++; +GLmethod.enable = i++; +GLmethod.enableVertexAttribArray = i++; //50 +GLmethod.flush = i++; +GLmethod.framebufferRenderbuffer = i++; +GLmethod.framebufferTexture2D = i++; +GLmethod.frontFace = i++; +GLmethod.generateMipmap = i++; +GLmethod.getActiveAttrib = i++; +GLmethod.getActiveUniform = i++; +GLmethod.getAttachedShaders = i++; +GLmethod.getAttribLocation = i++; +GLmethod.getBufferParameter = i++; //60 +GLmethod.getContextAttributes = i++; +GLmethod.getError = i++; +GLmethod.getExtension = i++; +GLmethod.getFramebufferAttachmentParameter = i++; +GLmethod.getParameter = i++; +GLmethod.getProgramInfoLog = i++; +GLmethod.getProgramParameter = i++; +GLmethod.getRenderbufferParameter = i++; +GLmethod.getShaderInfoLog = i++; +GLmethod.getShaderParameter = i++; //70 +GLmethod.getShaderPrecisionFormat = i++; +GLmethod.getShaderSource = i++; +GLmethod.getSupportedExtensions = i++; +GLmethod.getTexParameter = i++; +GLmethod.getUniform = i++; +GLmethod.getUniformLocation = i++; +GLmethod.getVertexAttrib = i++; +GLmethod.getVertexAttribOffset = i++; +GLmethod.isBuffer = i++; +GLmethod.isContextLost = i++; //80 +GLmethod.isEnabled = i++; +GLmethod.isFramebuffer = i++; +GLmethod.isProgram = i++; +GLmethod.isRenderbuffer = i++; +GLmethod.isShader = i++; +GLmethod.isTexture = i++; +GLmethod.lineWidth = i++; +GLmethod.linkProgram = i++; +GLmethod.pixelStorei = i++; +GLmethod.polygonOffset = i++; //90 +GLmethod.readPixels = i++; +GLmethod.renderbufferStorage = i++; +GLmethod.sampleCoverage = i++; +GLmethod.scissor = i++; +GLmethod.shaderSource = i++; +GLmethod.stencilFunc = i++; +GLmethod.stencilFuncSeparate = i++; +GLmethod.stencilMask = i++; +GLmethod.stencilMaskSeparate = i++; +GLmethod.stencilOp = i++; //100 +GLmethod.stencilOpSeparate = i++; +GLmethod.texImage2D = i++; +GLmethod.texParameterf = i++; +GLmethod.texParameteri = i++; +GLmethod.texSubImage2D = i++; +GLmethod.uniform1f = i++; +GLmethod.uniform1fv = i++; +GLmethod.uniform1i = i++; +GLmethod.uniform1iv = i++; +GLmethod.uniform2f = i++; //110 +GLmethod.uniform2fv = i++; +GLmethod.uniform2i = i++; +GLmethod.uniform2iv = i++; +GLmethod.uniform3f = i++; +GLmethod.uniform3fv = i++; +GLmethod.uniform3i = i++; +GLmethod.uniform3iv = i++; +GLmethod.uniform4f = i++; +GLmethod.uniform4fv = i++; +GLmethod.uniform4i = i++; //120 +GLmethod.uniform4iv = i++; +GLmethod.uniformMatrix2fv = i++; +GLmethod.uniformMatrix3fv = i++; +GLmethod.uniformMatrix4fv = i++; +GLmethod.useProgram = i++; +GLmethod.validateProgram = i++; +GLmethod.vertexAttrib1f = i++; //new +GLmethod.vertexAttrib2f = i++; //new +GLmethod.vertexAttrib3f = i++; //new +GLmethod.vertexAttrib4f = i++; //new //130 +GLmethod.vertexAttrib1fv = i++; //new +GLmethod.vertexAttrib2fv = i++; //new +GLmethod.vertexAttrib3fv = i++; //new +GLmethod.vertexAttrib4fv = i++; //new +GLmethod.vertexAttribPointer = i++; +GLmethod.viewport = i++; + +export default GLmethod; \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/context-webgl/GLtype.js b/components/firstui/fui-autograph/gcanvas/context-webgl/GLtype.js new file mode 100644 index 0000000..43bb1c8 --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/context-webgl/GLtype.js @@ -0,0 +1,23 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 861 4 0 7254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +const GLtype = {}; + +[ + "GLbitfield", + "GLboolean", + "GLbyte", + "GLclampf", + "GLenum", + "GLfloat", + "GLint", + "GLintptr", + "GLsizei", + "GLsizeiptr", + "GLshort", + "GLubyte", + "GLuint", + "GLushort" +].sort().map((typeName, i) => GLtype[typeName] = 1 >> (i + 1)); + +export default GLtype; + + diff --git a/components/firstui/fui-autograph/gcanvas/context-webgl/Program.js b/components/firstui/fui-autograph/gcanvas/context-webgl/Program.js new file mode 100644 index 0000000..adb09b5 --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/context-webgl/Program.js @@ -0,0 +1,22 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 861407 2 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLProgram'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLProgram { + className = name; + + constructor(id) { + this.id = id; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/context-webgl/Renderbuffer.js b/components/firstui/fui-autograph/gcanvas/context-webgl/Renderbuffer.js new file mode 100644 index 0000000..b2514f5 --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/context-webgl/Renderbuffer.js @@ -0,0 +1,22 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1861407 25 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLRenderBuffer'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLRenderbuffer { + className = name; + + constructor(id) { + this.id = id; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/context-webgl/RenderingContext.js b/components/firstui/fui-autograph/gcanvas/context-webgl/RenderingContext.js new file mode 100644 index 0000000..cfb38ca --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/context-webgl/RenderingContext.js @@ -0,0 +1,1192 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 61407 254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import GLenum from './GLenum'; +import ActiveInfo from './ActiveInfo'; +import Buffer from './Buffer'; +import Framebuffer from './Framebuffer'; +import Renderbuffer from './Renderbuffer'; +import Texture from './Texture'; +import Program from './Program'; +import Shader from './Shader'; +import ShaderPrecisionFormat from './ShaderPrecisionFormat'; +import UniformLocation from './UniformLocation'; +import GLmethod from './GLmethod'; + +const processArray = (array, checkArrayType = false) => { + + function joinArray(arr, sep) { + let res = ''; + for (let i = 0; i < arr.length; i++) { + if (i !== 0) { + res += sep; + } + res += arr[i]; + } + return res; + } + + let type = 'Float32Array'; + if (checkArrayType) { + if (array instanceof Uint8Array) { + type = 'Uint8Array' + } else if (array instanceof Uint16Array) { + type = 'Uint16Array'; + } else if (array instanceof Uint32Array) { + type = 'Uint32Array'; + } else if (array instanceof Float32Array) { + type = 'Float32Array'; + } else { + throw new Error('Check array type failed. Array type is ' + typeof array); + } + } + + const ArrayTypes = { + Uint8Array: 1, + Uint16Array: 2, + Uint32Array: 4, + Float32Array: 14 + }; + return ArrayTypes[type] + ',' + btoa(joinArray(array, ',')) +} + +export default class WebGLRenderingContext { + + // static GBridge = null; + + className = 'WebGLRenderingContext'; + + constructor(canvas, type, attrs) { + this._canvas = canvas; + this._type = type; + this._version = 'WebGL 1.0'; + this._attrs = attrs; + this._map = new Map(); + + Object.keys(GLenum) + .forEach(name => Object.defineProperty(this, name, { + value: GLenum[name] + })); + } + + get canvas() { + return this._canvas; + } + + activeTexture = function (textureUnit) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.activeTexture + ',' + textureUnit, + true + ); + } + + attachShader = function (progarm, shader) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.attachShader + ',' + progarm.id + ',' + shader.id, + true + ); + } + + bindAttribLocation = function (program, index, name) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindAttribLocation + ',' + program.id + ',' + index + ',' + name, + true + ) + } + + bindBuffer = function (target, buffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindBuffer + ',' + target + ',' + (buffer ? buffer.id : 0), + true + ); + } + + bindFramebuffer = function (target, framebuffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindFramebuffer + ',' + target + ',' + (framebuffer ? framebuffer.id : 0), + true + ) + } + + bindRenderbuffer = function (target, renderBuffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindRenderbuffer + ',' + target + ',' + (renderBuffer ? renderBuffer.id : 0), + true + ) + } + + bindTexture = function (target, texture) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindTexture + ',' + target + ',' + (texture ? texture.id : 0), + true + ) + } + + blendColor = function (r, g, b, a) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendColor + ',' + target + ',' + r + ',' + g + ',' + b + ',' + a, + true + ) + } + + blendEquation = function (mode) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendEquation + ',' + mode, + true + ) + } + + blendEquationSeparate = function (modeRGB, modeAlpha) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendEquationSeparate + ',' + modeRGB + ',' + modeAlpha, + true + ) + } + + + blendFunc = function (sfactor, dfactor) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendFunc + ',' + sfactor + ',' + dfactor, + true + ); + } + + blendFuncSeparate = function (srcRGB, dstRGB, srcAlpha, dstAlpha) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendFuncSeparate + ',' + srcRGB + ',' + dstRGB + ',' + srcAlpha + ',' + dstAlpha, + true + ); + } + + bufferData = function (target, data, usage) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bufferData + ',' + target + ',' + processArray(data, true) + ',' + usage, + true + ) + } + + bufferSubData = function (target, offset, data) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bufferSubData + ',' + target + ',' + offset + ',' + processArray(data, true), + true + ) + } + + checkFramebufferStatus = function (target) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.checkFramebufferStatus + ',' + target + ); + return Number(result); + } + + clear = function (mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.clear + ',' + mask + ); + this._canvas._needRender = true; + } + + clearColor = function (r, g, b, a) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.clearColor + ',' + r + ',' + g + ',' + b, + true + ) + } + + clearDepth = function (depth) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.clearDepth + ',' + depth, + true + ) + } + + clearStencil = function (s) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.clearStencil + ',' + s + ); + } + + colorMask = function (r, g, b, a) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.colorMask + ',' + r + ',' + g + ',' + b + ',' + a + ) + } + + compileShader = function (shader) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.compileShader + ',' + shader.id, + true + ) + } + + compressedTexImage2D = function (target, level, internalformat, width, height, border, pixels) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.compressedTexImage2D + ',' + target + ',' + level + ',' + internalformat + ',' + + width + ',' + height + ',' + border + ',' + processArray(pixels), + true + ) + } + + compressedTexSubImage2D = function (target, level, xoffset, yoffset, width, height, format, pixels) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.compressedTexSubImage2D + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset + ',' + + width + ',' + height + ',' + format + ',' + processArray(pixels), + true + ) + } + + + copyTexImage2D = function (target, level, internalformat, x, y, width, height, border) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.copyTexImage2D + ',' + target + ',' + level + ',' + internalformat + ',' + x + ',' + y + ',' + + width + ',' + height + ',' + border, + true + ); + } + + copyTexSubImage2D = function (target, level, xoffset, yoffset, x, y, width, height) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.copyTexSubImage2D + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset + ',' + x + ',' + y + ',' + + width + ',' + height + ); + } + + createBuffer = function () { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createBuffer + '' + ); + const buffer = new Buffer(result); + this._map.set(buffer.uuid(), buffer); + return buffer; + } + + createFramebuffer = function () { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createFramebuffer + '' + ); + const framebuffer = new Framebuffer(result); + this._map.set(framebuffer.uuid(), framebuffer); + return framebuffer; + } + + + createProgram = function () { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createProgram + '' + ); + const program = new Program(id); + this._map.set(program.uuid(), program); + return program; + } + + createRenderbuffer = function () { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createRenderbuffer + '' + ) + const renderBuffer = new Renderbuffer(id); + this._map.set(renderBuffer.uuid(), renderBuffer); + return renderBuffer; + } + + createShader = function (type) { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createShader + ',' + type + ) + const shader = new Shader(id, type); + this._map.set(shader.uuid(), shader); + return shader; + } + + createTexture = function () { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createTexture + '' + ); + const texture = new Texture(id); + this._map.set(texture.uuid(), texture); + return texture; + } + + cullFace = function (mode) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.cullFace + ',' + mode, + true + ) + } + + + deleteBuffer = function (buffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteBuffer + ',' + buffer.id, + true + ) + } + + deleteFramebuffer = function (framebuffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteFramebuffer + ',' + framebuffer.id, + true + ) + } + + deleteProgram = function (program) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteProgram + ',' + program.id, + true + ) + } + + deleteRenderbuffer = function (renderbuffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteRenderbuffer + ',' + renderbuffer.id, + true + ) + } + + deleteShader = function (shader) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteShader + ',' + shader.id, + true + ) + } + + deleteTexture = function (texture) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteTexture + ',' + texture.id, + true + ) + } + + depthFunc = function (func) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.depthFunc + ',' + func + ) + } + + depthMask = function (flag) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.depthMask + ',' + Number(flag), + true + ) + } + + depthRange = function (zNear, zFar) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.depthRange + ',' + zNear + ',' + zFar, + true + ) + } + + detachShader = function (program, shader) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.detachShader + ',' + program.id + ',' + shader.id, + true + ) + } + + disable = function (cap) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.disable + ',' + cap, + true + ) + } + + disableVertexAttribArray = function (index) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.disableVertexAttribArray + ',' + index, + true + ); + } + + drawArrays = function (mode, first, count) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.drawArrays + ',' + mode + ',' + first + ',' + count + ) + this._canvas._needRender = true; + } + + drawElements = function (mode, count, type, offset) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.drawElements + ',' + mode + ',' + count + ',' + type + ',' + offset + ';' + ); + this._canvas._needRender = true; + } + + enable = function (cap) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.enable + ',' + cap, + true + ); + } + + enableVertexAttribArray = function (index) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.enableVertexAttribArray + ',' + index, + true + ) + } + + + flush = function () { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.flush + '' + ) + } + + framebufferRenderbuffer = function (target, attachment, textarget, texture, level) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.framebufferRenderbuffer + ',' + target + ',' + attachment + ',' + textarget + ',' + (texture ? texture.id : 0) + ',' + level, + true + ) + } + + framebufferTexture2D = function (target, attachment, textarget, texture, level) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.framebufferTexture2D + ',' + target + ',' + attachment + ',' + textarget + ',' + (texture ? texture.id : 0) + ',' + level, + true + ) + } + + frontFace = function (mode) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.frontFace + ',' + mode, + true + ) + } + + generateMipmap = function (target) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.generateMipmap + ',' + target, + true + ) + } + + getActiveAttrib = function (progarm, index) { + const resultString = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getActiveAttrib + ',' + progarm.id + ',' + index + ) + const [type, size, name] = resultString.split(','); + return new ActiveInfo({ + type: Number(type), + size: Number(size), + name + }); + } + + getActiveUniform = function (progarm, index) { + const resultString = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getActiveUniform + ',' + progarm.id + ',' + index + ); + const [type, size, name] = resultString.split(','); + return new ActiveInfo({ + type: Number(type), + size: Number(size), + name + }) + } + + getAttachedShaders = function (progarm) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getAttachedShaders + ',' + progarm.id + ); + const [type, ...ids] = result; + return ids.map(id => this._map.get(Shader.uuid(id))); + } + + getAttribLocation = function (progarm, name) { + return WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getAttribLocation + ',' + progarm.id + ',' + name + ) + } + + getBufferParameter = function (target, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getBufferParameter + ',' + target + ',' + pname + ); + const [type, res] = getBufferParameter; + return res; + } + + getError = function () { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getError + '' + ) + return result; + } + + getExtension = function (name) { + return null; + } + + getFramebufferAttachmentParameter = function (target, attachment, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getFramebufferAttachmentParameter + ',' + target + ',' + attachment + ',' + pname + ) + switch (pname) { + case GLenum.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: + return this._map.get(Renderbuffer.uuid(result)) || this._map.get(Texture.uuid(result)) || null; + default: + return result; + } + } + + getParameter = function (pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getParameter + ',' + pname + ) + switch (pname) { + case GLenum.VERSION: + return this._version; + case GLenum.ARRAY_BUFFER_BINDING: // buffer + case GLenum.ELEMENT_ARRAY_BUFFER_BINDING: // buffer + return this._map.get(Buffer.uuid(result)) || null; + case GLenum.CURRENT_PROGRAM: // program + return this._map.get(Program.uuid(result)) || null; + case GLenum.FRAMEBUFFER_BINDING: // framebuffer + return this._map.get(Framebuffer.uuid(result)) || null; + case GLenum.RENDERBUFFER_BINDING: // renderbuffer + return this._map.get(Renderbuffer.uuid(result)) || null; + case GLenum.TEXTURE_BINDING_2D: // texture + case GLenum.TEXTURE_BINDING_CUBE_MAP: // texture + return this._map.get(Texture.uuid(result)) || null; + case GLenum.ALIASED_LINE_WIDTH_RANGE: // Float32Array + case GLenum.ALIASED_POINT_SIZE_RANGE: // Float32Array + case GLenum.BLEND_COLOR: // Float32Array + case GLenum.COLOR_CLEAR_VALUE: // Float32Array + case GLenum.DEPTH_RANGE: // Float32Array + case GLenum.MAX_VIEWPORT_DIMS: // Int32Array + case GLenum.SCISSOR_BOX: // Int32Array + case GLenum.VIEWPORT: // Int32Array + case GLenum.COMPRESSED_TEXTURE_FORMATS: // Uint32Array + default: + const [type, ...res] = result.split(','); + if (res.length === 1) { + return Number(res[0]); + } else { + return res.map(Number); + } + } + } + + getProgramInfoLog = function (progarm) { + return WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getProgramInfoLog + ',' + progarm.id + ) + } + + getProgramParameter = function (program, pname) { + const res = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getProgramParameter + ',' + program.id + ',' + pname + ); + + const [type, result] = res.split(',').map(i => parseInt(i)); + + if (type === 1) { + return Boolean(result); + } else if (type === 2) { + return result; + } else { + throw new Error('Unrecongized program paramater ' + res + ', type: ' + typeof res); + } + } + + + getRenderbufferParameter = function (target, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getRenderbufferParameter + ',' + target + ',' + pname + ) + return result; + } + + + getShaderInfoLog = function (shader) { + return WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getShaderInfoLog + ',' + shader.id + ); + } + + getShaderParameter = function (shader, pname) { + return WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getShaderParameter + ',' + shader.id + ',' + pname + ) + } + + getShaderPrecisionFormat = function (shaderType, precisionType) { + const [rangeMin, rangeMax, precision] = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getShaderPrecisionFormat + ',' + shaderType + ',' + precisionType + ); + const shaderPrecisionFormat = new ShaderPrecisionFormat({ + rangeMin: Number(rangeMin), + rangeMax: Number(rangeMax), + precision: Number(precision) + }); + return shaderPrecisionFormat; + } + + getShaderSource = function (shader) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getShaderSource + ',' + shader.id + ); + return result; + } + + getSupportedExtensions = function () { + return Object.keys({}); + } + + getTexParameter = function (target, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getTexParameter + ',' + target + ',' + pname + ) + return result; + } + + getUniformLocation = function (program, name) { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getUniformLocation + ',' + program.id + ',' + name + ); + if (id === -1) { + return null; + } else { + return new UniformLocation(Number(id)); + } + } + + getVertexAttrib = function (index, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getVertexAttrib + ',' + index + ',' + pname + ); + switch (pname) { + case GLenum.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: + return this._map.get(Buffer.uuid(result)) || null; + case GLenum.CURRENT_VERTEX_ATTRIB: // Float32Array + default: + return result; + } + } + + getVertexAttribOffset = function (index, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getVertexAttribOffset + ',' + index + ',' + pname + ) + return Number(result); + } + + isBuffer = function (buffer) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isBuffer + ',' + buffer.id + ) + return Boolean(result); + } + + isContextLost = function () { + return false; + } + + isEnabled = function (cap) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isEnabled + ',' + cap + ) + return Boolean(result); + } + + isFramebuffer = function (framebuffer) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isFramebuffer + ',' + framebuffer.id + ) + return Boolean(result); + } + + isProgram = function (program) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isProgram + ',' + program.id + ) + return Boolean(result); + } + + isRenderbuffer = function (renderBuffer) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isRenderbuffer + ',' + renderbuffer.id + ) + return Boolean(result); + } + + isShader = function (shader) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isShader + ',' + shader.id + ) + return Boolean(result); + } + + isTexture = function (texture) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isTexture + ',' + texture.id + ); + return Boolean(result); + } + + lineWidth = function (width) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.lineWidth + ',' + width, + true + ) + } + + linkProgram = function (program) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.linkProgram + ',' + program.id, + true + ); + } + + + pixelStorei = function (pname, param) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.pixelStorei + ',' + pname + ',' + Number(param) + ) + } + + polygonOffset = function (factor, units) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.polygonOffset + ',' + factor + ',' + units + ) + } + + readPixels = function (x, y, width, height, format, type, pixels) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.readPixels + ',' + x + ',' + y + ',' + width + ',' + height + ',' + format + ',' + type + ) + return result; + } + + renderbufferStorage = function (target, internalFormat, width, height) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.renderbufferStorage + ',' + target + ',' + internalFormat + ',' + width + ',' + height, + true + ) + } + + sampleCoverage = function (value, invert) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.sampleCoverage + ',' + value + ',' + Number(invert), + true + ) + } + + scissor = function (x, y, width, height) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.scissor + ',' + x + ',' + y + ',' + width + ',' + height, + true + ) + } + + shaderSource = function (shader, source) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.shaderSource + ',' + shader.id + ',' + source + ) + } + + stencilFunc = function (func, ref, mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilFunc + ',' + func + ',' + ref + ',' + mask, + true + ) + } + + stencilFuncSeparate = function (face, func, ref, mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilFuncSeparate + ',' + face + ',' + func + ',' + ref + ',' + mask, + true + ) + } + + stencilMask = function (mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilMask + ',' + mask, + true + ) + } + + stencilMaskSeparate = function (face, mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilMaskSeparate + ',' + face + ',' + mask, + true + ) + } + + stencilOp = function (fail, zfail, zpass) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilOp + ',' + fail + ',' + zfail + ',' + zpass + ) + } + + stencilOpSeparate = function (face, fail, zfail, zpass) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilOp + ',' + face + ',' + fail + ',' + zfail + ',' + zpass, + true + ) + } + + texImage2D = function (...args) { + WebGLRenderingContext.GBridge.texImage2D(this._canvas.id, ...args); + } + + + texParameterf = function (target, pname, param) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.texParameterf + ',' + target + ',' + pname + ',' + param, + true + ) + } + + texParameteri = function (target, pname, param) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.texParameteri + ',' + target + ',' + pname + ',' + param + ) + } + + texSubImage2D = function (...args) { + WebGLRenderingContext.GBridge.texSubImage2D(this._canvas.id, ...args); + } + + uniform1f = function (location, v0) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform1f + ',' + location.id + ',' + v0 + ) + } + + uniform1fv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform1fv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform1i = function (location, v0) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform1i + ',' + location.id + ',' + v0, + // true + ) + } + + uniform1iv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform1iv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform2f = function (location, v0, v1) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform2f + ',' + location.id + ',' + v0 + ',' + v1, + true + ) + } + + uniform2fv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform2fv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform2i = function (location, v0, v1) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform2i + ',' + location.id + ',' + v0 + ',' + v1, + true + ) + } + + uniform2iv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform2iv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform3f = function (location, v0, v1, v2) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform3f + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2, + true + ) + } + + uniform3fv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform3fv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform3i = function (location, v0, v1, v2) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform3i + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2, + true + ) + } + + uniform3iv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform3iv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform4f = function (location, v0, v1, v2, v3) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform4f + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2 + ',' + v3, + true + ) + } + + uniform4fv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform4fv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform4i = function (location, v0, v1, v2, v3) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform4i + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2 + ',' + v3, + true + ) + } + + uniform4iv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform4iv + ',' + location.id + ',' + processArray(value, true), + true + ) + } + + uniformMatrix2fv = function (location, transpose, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniformMatrix2fv + ',' + location.id + ',' + Number(transpose) + ',' + processArray(value), + true + ) + } + + uniformMatrix3fv = function (location, transpose, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniformMatrix3fv + ',' + location.id + ',' + Number(transpose) + ',' + processArray(value), + true + ) + } + + uniformMatrix4fv = function (location, transpose, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniformMatrix4fv + ',' + location.id + ',' + Number(transpose) + ',' + processArray(value), + true + ); + } + + useProgram = function (progarm) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.useProgram + ',' + progarm.id + '', + true + ) + } + + + validateProgram = function (program) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.validateProgram + ',' + program.id, + true + ) + } + + vertexAttrib1f = function (index, v0) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib1f + ',' + index + ',' + v0, + true + ) + } + + vertexAttrib2f = function (index, v0, v1) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib2f + ',' + index + ',' + v0 + ',' + v1, + true + ) + } + + vertexAttrib3f = function (index, v0, v1, v2) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib3f + ',' + index + ',' + v0 + ',' + v1 + ',' + v2, + true + ) + } + + vertexAttrib4f = function (index, v0, v1, v2, v3) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib4f + ',' + index + ',' + v0 + ',' + v1 + ',' + v2 + ',' + v3, + true + ) + } + + vertexAttrib1fv = function (index, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib1fv + ',' + index + ',' + processArray(value), + true + ) + } + + vertexAttrib2fv = function (index, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib2fv + ',' + index + ',' + processArray(value), + true + ) + } + + vertexAttrib3fv = function (index, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib3fv + ',' + index + ',' + processArray(value), + true + ) + } + + vertexAttrib4fv = function (index, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib4fv + ',' + index + ',' + processArray(value), + true + ) + } + + vertexAttribPointer = function (index, size, type, normalized, stride, offset) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttribPointer + ',' + index + ',' + size + ',' + type + ',' + Number(normalized) + ',' + stride + ',' + offset, + true + ) + } + + viewport = function (x, y, width, height) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.viewport + ',' + x + ',' + y + ',' + width + ',' + height, + true + ) + } +} \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/context-webgl/Shader.js b/components/firstui/fui-autograph/gcanvas/context-webgl/Shader.js new file mode 100644 index 0000000..b48fd33 --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/context-webgl/Shader.js @@ -0,0 +1,23 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 86 14 07 2 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLShader'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLShader { + className = name; + + constructor(id, type) { + this.id = id; + this.type = type; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/context-webgl/ShaderPrecisionFormat.js b/components/firstui/fui-autograph/gcanvas/context-webgl/ShaderPrecisionFormat.js new file mode 100644 index 0000000..52b14bf --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/context-webgl/ShaderPrecisionFormat.js @@ -0,0 +1,12 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1861 407 2 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +export default class WebGLShaderPrecisionFormat { + className = 'WebGLShaderPrecisionFormat'; + + constructor({ + rangeMin, rangeMax, precision + }) { + this.rangeMin = rangeMin; + this.rangeMax = rangeMax; + this.precision = precision; + } +} \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/context-webgl/Texture.js b/components/firstui/fui-autograph/gcanvas/context-webgl/Texture.js new file mode 100644 index 0000000..bf58e74 --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/context-webgl/Texture.js @@ -0,0 +1,23 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 614 0 7254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLTexture'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLTexture { + className = name; + + constructor(id, type) { + this.id = id; + this.type = type; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/context-webgl/UniformLocation.js b/components/firstui/fui-autograph/gcanvas/context-webgl/UniformLocation.js new file mode 100644 index 0000000..70b9963 --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/context-webgl/UniformLocation.js @@ -0,0 +1,23 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8614 0 72 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLUniformLocation'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLUniformLocation { + className = name; + + constructor(id, type) { + this.id = id; + this.type = type; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/context-webgl/classUtils.js b/components/firstui/fui-autograph/gcanvas/context-webgl/classUtils.js new file mode 100644 index 0000000..ab0c687 --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/context-webgl/classUtils.js @@ -0,0 +1,4 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8 6 140 725 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +export function getTransferedObjectUUID(name, id) { + return `${name.toLowerCase()}-${id}`; +} \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/env/canvas.js b/components/firstui/fui-autograph/gcanvas/env/canvas.js new file mode 100644 index 0000000..6e53398 --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/env/canvas.js @@ -0,0 +1,75 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 61 407 2 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import GContext2D from '../context-2d/RenderingContext'; +import GContextWebGL from '../context-webgl/RenderingContext'; + +export default class GCanvas { + + // static GBridge = null; + + id = null; + + _needRender = true; + + constructor(id, { disableAutoSwap }) { + this.id = id; + + this._disableAutoSwap = disableAutoSwap; + if (disableAutoSwap) { + this._swapBuffers = () => { + GCanvas.GBridge.render(this.id); + } + } + } + + getContext(type) { + + let context = null; + + if (type.match(/webgl/i)) { + context = new GContextWebGL(this); + + context.componentId = this.id; + + if (!this._disableAutoSwap) { + const render = () => { + if (this._needRender) { + GCanvas.GBridge.render(this.id); + this._needRender = false; + } + } + setInterval(render, 16); + } + + GCanvas.GBridge.callSetContextType(this.id, 1); // 0 for 2d; 1 for webgl + } else if (type.match(/2d/i)) { + context = new GContext2D(this); + + context.componentId = this.id; + +// const render = ( callback ) => { +// +// const commands = context._drawCommands; +// context._drawCommands = ''; +// +// GCanvas.GBridge.render2d(this.id, commands, callback); +// this._needRender = false; +// } +// //draw方法触发 +// context._flush = render; +// //setInterval(render, 16); + + GCanvas.GBridge.callSetContextType(this.id, 0); + } else { + throw new Error('not supported context ' + type); + } + + return context; + + } + + reset() { + GCanvas.GBridge.callReset(this.id); + } + + +} \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/env/image.js b/components/firstui/fui-autograph/gcanvas/env/image.js new file mode 100644 index 0000000..4faab95 --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/env/image.js @@ -0,0 +1,97 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 61 40 7254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +let incId = 1; + +const noop = function () { }; + +class GImage { + + static GBridge = null; + + constructor() { + this._id = incId++; + this._width = 0; + this._height = 0; + this._src = undefined; + this._onload = noop; + this._onerror = noop; + this.complete = false; + } + + get width() { + return this._width; + } + set width(v) { + this._width = v; + } + + get height() { + return this._height; + } + + set height(v) { + this._height = v; + } + + get src() { + return this._src; + } + + set src(v) { + + if (v.startsWith('//')) { + v = 'http:' + v; + } + + this._src = v; + + GImage.GBridge.perloadImage([this._src, this._id], (data) => { + if (typeof data === 'string') { + data = JSON.parse(data); + } + if (data.error) { + var evt = { type: 'error', target: this }; + this.onerror(evt); + } else { + this.complete = true; + this.width = typeof data.width === 'number' ? data.width : 0; + this.height = typeof data.height === 'number' ? data.height : 0; + var evt = { type: 'load', target: this }; + this.onload(evt); + } + }); + } + + addEventListener(name, listener) { + if (name === 'load') { + this.onload = listener; + } else if (name === 'error') { + this.onerror = listener; + } + } + + removeEventListener(name, listener) { + if (name === 'load') { + this.onload = noop; + } else if (name === 'error') { + this.onerror = noop; + } + } + + get onload() { + return this._onload; + } + + set onload(v) { + this._onload = v; + } + + get onerror() { + return this._onerror; + } + + set onerror(v) { + this._onerror = v; + } +} + +export default GImage; \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/env/tool.js b/components/firstui/fui-autograph/gcanvas/env/tool.js new file mode 100644 index 0000000..46a9925 --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/env/tool.js @@ -0,0 +1,25 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8 6 14 0 7 2 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 + +export function ArrayBufferToBase64 (buffer) { + var binary = ''; + var bytes = new Uint8ClampedArray(buffer); + for (var len = bytes.byteLength, i = 0; i < len; i++) { + binary += String.fromCharCode(bytes[i]); + } + return btoa(binary); +} + +export function Base64ToUint8ClampedArray(base64String) { + const padding = '='.repeat((4 - base64String.length % 4) % 4); + const base64 = (base64String + padding) + .replace(/\-/g, '+') + .replace(/_/g, '/'); + + const rawData = atob(base64); + const outputArray = new Uint8ClampedArray(rawData.length); + + for (let i = 0; i < rawData.length; ++i) { + outputArray[i] = rawData.charCodeAt(i); + } + return outputArray; +} \ No newline at end of file diff --git a/components/firstui/fui-autograph/gcanvas/index.js b/components/firstui/fui-autograph/gcanvas/index.js new file mode 100644 index 0000000..8b9760b --- /dev/null +++ b/components/firstui/fui-autograph/gcanvas/index.js @@ -0,0 +1,48 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 86 14 072 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import GCanvas from './env/canvas'; +import GImage from './env/image'; + +import GWebGLRenderingContext from './context-webgl/RenderingContext'; +import GContext2D from './context-2d/RenderingContext'; + +import GBridgeWeex from './bridge/bridge-weex'; + +export let Image = GImage; + +export let WeexBridge = GBridgeWeex; + +export function enable(el, { + bridge, + debug, + disableAutoSwap, + disableComboCommands +} = {}) { + + const GBridge = GImage.GBridge = GCanvas.GBridge = GWebGLRenderingContext.GBridge = GContext2D.GBridge = bridge; + + GBridge.callEnable(el.ref, [ + 0, // renderMode: 0--RENDERMODE_WHEN_DIRTY, 1--RENDERMODE_CONTINUOUSLY + -1, // hybridLayerType: 0--LAYER_TYPE_NONE 1--LAYER_TYPE_SOFTWARE 2--LAYER_TYPE_HARDWARE + false, // supportScroll + false, // newCanvasMode + 1, // compatible + 'white', // clearColor + false // sameLevel: newCanvasMode = true && true => GCanvasView and Webview is same level + ]); + + if (debug === true) { + GBridge.callEnableDebug(); + } + if (disableComboCommands) { + GBridge.callEnableDisableCombo(); + } + + var canvas = new GCanvas(el.ref, { + disableAutoSwap + }); + let pixelRatio = uni.getSystemInfoSync().pixelRatio; + canvas.width = el.style.width * pixelRatio; + canvas.height = el.style.height * pixelRatio; + + return canvas; +}; \ No newline at end of file diff --git a/components/firstui/fui-avatar/fui-avatar.vue b/components/firstui/fui-avatar/fui-avatar.vue new file mode 100644 index 0000000..fa6e0b6 --- /dev/null +++ b/components/firstui/fui-avatar/fui-avatar.vue @@ -0,0 +1,242 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-backdrop/fui-backdrop.vue b/components/firstui/fui-backdrop/fui-backdrop.vue new file mode 100644 index 0000000..6d42434 --- /dev/null +++ b/components/firstui/fui-backdrop/fui-backdrop.vue @@ -0,0 +1,179 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-backtop/fui-backtop.vue b/components/firstui/fui-backtop/fui-backtop.vue new file mode 100644 index 0000000..d9d688c --- /dev/null +++ b/components/firstui/fui-backtop/fui-backtop.vue @@ -0,0 +1,132 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-badge/fui-badge.vue b/components/firstui/fui-badge/fui-badge.vue new file mode 100644 index 0000000..61a71c9 --- /dev/null +++ b/components/firstui/fui-badge/fui-badge.vue @@ -0,0 +1,234 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-banner-arc/fui-banner-arc.vue b/components/firstui/fui-banner-arc/fui-banner-arc.vue new file mode 100644 index 0000000..69736b1 --- /dev/null +++ b/components/firstui/fui-banner-arc/fui-banner-arc.vue @@ -0,0 +1,156 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-barcode/barcode.js b/components/firstui/fui-barcode/barcode.js new file mode 100644 index 0000000..a823270 --- /dev/null +++ b/components/firstui/fui-barcode/barcode.js @@ -0,0 +1,205 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 6140 72 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +/* + * Copyright (c) 2014 Johannes Mittendorfer (http://johannes-mittendorfer.com) + * Licensed under the MIT License (LICENSE.txt). + * + * Version 2.1.1 + * Build 2014-10-07 + */ + +var EAN13, pluginName; + +pluginName = null; + +"use strict"; + +EAN13 = (function() { + EAN13.prototype.settings = {}; + + EAN13.prototype.init = function() { + var checkDigit, code; + if (this.number.length === 12) { + checkDigit = this.generateCheckDigit(this.number); + this.number += checkDigit; + } + if (this.number.length === 13) { + if (this.validate()) { + this.settings.onValid.call(); + } else { + this.settings.onInvalid.call(); + } + code = this.getCode(); + return this.draw(code); + } else { + return this.settings.onError.call(); + } + }; + + EAN13.prototype.getCode = function() { + var c_encoding, code, countries, i, parts, raw_number, x, y, z; + x = ["0001101", "0011001", "0010011", "0111101", "0100011", "0110001", "0101111", "0111011", "0110111", "0001011"]; + y = ["0100111", "0110011", "0011011", "0100001", "0011101", "0111001", "0000101", "0010001", "0001001", "0010111"]; + z = ["1110010", "1100110", "1101100", "1000010", "1011100", "1001110", "1010000", "1000100", "1001000", "1110100"]; + countries = ["xxxxxx", "xxyxyy", "xxyyxy", "xxyyyx", "xyxxyy", "xyyxxy", "xyyyxx", "xyxyxy", "xyxyyx", "xyyxyx"]; + code = ""; + c_encoding = countries[parseInt(this.number.substr(0, 1), 10)].split(""); + raw_number = this.number.substr(1); + parts = raw_number.split(""); + i = 0; + while (i < 6) { + if (c_encoding[i] === "x") { + code += x[parts[i]]; + } else { + code += y[parts[i]]; + } + i++; + } + i = 6; + while (i < 12) { + code += z[parts[i]]; + i++; + } + return code; + }; + + EAN13.prototype.clear = function(context) { + return context.clearRect(0, 0, this.settings.width, this.settings.height); + }; + + EAN13.prototype.draw = function(code) { + var border_height, chars, context, height, i, item_width, layout, left, lines, offset, prefix, width, x, _i, _ref; + layout = { + prefix_offset: 0.06, + font_stretch: 0.073, + border_line_height_number: 0.9, + border_line_height: 1, + line_height: 0.9, + font_size: 0.15, + font_y: 1.03, + text_offset: 4.5 + }; + width = (this.settings.prefix ? this.settings.width - (this.settings.width * layout.prefix_offset) : this.settings.width); + if (this.settings.number) { + border_height = layout.border_line_height_number * this.settings.height; + height = layout.line_height * border_height; + } else { + border_height = layout.border_line_height * this.settings.height; + height = border_height; + } + item_width = width / 95; + if (this.ctx) { + context = this.ctx; + this.clear(context); + context.setFillStyle(this.settings.color); + left = this.settings.number && this.settings.prefix ? this.settings.width * layout.prefix_offset : 0; + lines = code.split(""); + context.fillRect(left, 0, item_width, border_height); + left = left + item_width * 2; + context.fillRect(left, 0, item_width, border_height); + left = left + item_width; + i = 0; + while (i < 42) { + if (lines[i] === "1") { + context.fillRect(left, 0, Math.floor(item_width) + 1, height); + } + left = left + item_width; + i++; + } + left = left + item_width; + context.fillRect(left, 0, item_width, border_height); + left = left + item_width * 2; + context.fillRect(left, 0, item_width, border_height); + left = left + item_width * 2; + i = 42; + while (i < 84) { + if (lines[i] === "1") { + context.fillRect(left, 0, Math.floor(item_width) + 1, height); + } + left = left + item_width; + i++; + } + context.fillRect(left, 0, item_width, border_height); + left = left + item_width * 2; + context.fillRect(left, 0, item_width, border_height); + if (this.settings.number) { + context.setFontSize(layout.font_size * height + "px monospace"); + prefix = this.number.substr(0, 1); + if (this.settings.prefix) { + context.fillText(prefix, 0, border_height * layout.font_y); + } + offset = item_width * layout.text_offset + (this.settings.prefix ? layout.prefix_offset * this.settings.width : 0); + chars = this.number.substr(1, 6).split(""); + chars.forEach(function(value, key) { + context.fillText(value, offset, border_height * layout.font_y); + return offset += layout.font_stretch * width; + }); + offset = 49 * item_width + (this.settings.prefix ? layout.prefix_offset * this.settings.width : 0) + layout.text_offset; + chars = this.number.substr(7).split("") + chars.forEach(function(value, key) { + context.fillText(value, offset, border_height * layout.font_y); + return offset += layout.font_stretch * width; + }); + } + if (this.settings.debug) { + for (x = _i = 0, _ref = item_width * 2; _ref > 0 ? _i <= width : _i >= width; x = _i += _ref) { + context.beginPath(); + context.rect(x, height * 0.4, item_width, height * 0.1); + context.setFillStyle('red'); + context.fill(); + } + } + context.draw() + return this.settings.onSuccess.call(); + } else { + return this.settings.onError.call(); + } + }; + + EAN13.prototype.generateCheckDigit = function(number) { + var chars, counter; + counter = 0; + chars = number.split(""); + chars.forEach(function(value, key) { + if (key % 2 === 0) { + return counter += parseInt(value, 10); + } else { + return counter += 3 * parseInt(value, 10); + } + }); + return 10 - (counter % 10) % 10; + }; + + EAN13.prototype.validate = function() { + return parseInt(this.number.slice(-1), 10) === this.generateCheckDigit(this.number.slice(0, -1)); + }; + + function EAN13(number, options, ctx) { + var option; + this.number = number; + this.ctx = ctx + this.settings = { + width: 200, + height: 100, + number: true, + prefix: true, + color: "black", + debug: false, + onValid: function() {}, + onInvalid: function() {}, + onSuccess: function() {}, + onError: function() {} + }; + if (options) { + for (option in options) { + this.settings[option] = options[option]; + } + } + this._name = pluginName; + this.init(); + } + + return EAN13; + +})(); + +export default EAN13; \ No newline at end of file diff --git a/components/firstui/fui-barcode/fui-barcode.vue b/components/firstui/fui-barcode/fui-barcode.vue new file mode 100644 index 0000000..d11ed75 --- /dev/null +++ b/components/firstui/fui-barcode/fui-barcode.vue @@ -0,0 +1,142 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/bridge/bridge-weex.js b/components/firstui/fui-barcode/gcanvas/bridge/bridge-weex.js new file mode 100644 index 0000000..f5d649f --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/bridge/bridge-weex.js @@ -0,0 +1,242 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 86 140 7 2549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +const isWeex = typeof WXEnvironment !== 'undefined'; +const isWeexIOS = isWeex && /ios/i.test(WXEnvironment.platform); +const isWeexAndroid = isWeex && !isWeexIOS; + +import GLmethod from '../context-webgl/GLmethod'; + +const GCanvasModule = + (typeof weex !== 'undefined' && weex.requireModule) ? (weex.requireModule('gcanvas')) : + (typeof __weex_require__ !== 'undefined') ? (__weex_require__('@weex-module/gcanvas')) : {}; + +let isDebugging = false; + +let isComboDisabled = false; + +const logCommand = (function () { + const methodQuery = []; + Object.keys(GLmethod).forEach(key => { + methodQuery[GLmethod[key]] = key; + }) + const queryMethod = (id) => { + return methodQuery[parseInt(id)] || 'NotFoundMethod'; + } + const logCommand = (id, cmds) => { + const mId = cmds.split(',')[0]; + const mName = queryMethod(mId); + console.log(`=== callNative - componentId:${id}; method: ${mName}; cmds: ${cmds}`); + } + return logCommand; +})(); + +function joinArray(arr, sep) { + let res = ''; + for (let i = 0; i < arr.length; i++) { + if (i !== 0) { + res += sep; + } + res += arr[i]; + } + return res; +} + +const commandsCache = {} + +const GBridge = { + + callEnable: (ref, configArray) => { + + commandsCache[ref] = []; + + return GCanvasModule.enable({ + componentId: ref, + config: configArray + }); + }, + + callEnableDebug: () => { + isDebugging = true; + }, + + callEnableDisableCombo: () => { + isComboDisabled = true; + }, + + callSetContextType: function (componentId, context_type) { + GCanvasModule.setContextType(context_type, componentId); + }, + + callReset: function(id){ + GCanvasModule.resetComponent && canvasModule.resetComponent(componentId); + }, + + render: isWeexIOS ? function (componentId) { + return GCanvasModule.extendCallNative({ + contextId: componentId, + type: 0x60000001 + }); + } : function (componentId) { + return callGCanvasLinkNative(componentId, 0x60000001, 'render'); + }, + + render2d: isWeexIOS ? function (componentId, commands, callback) { + + if (isDebugging) { + console.log('>>> >>> render2d ==='); + console.log('>>> commands: ' + commands); + } + + GCanvasModule.render([commands, callback?true:false], componentId, callback); + + } : function (componentId, commands,callback) { + + if (isDebugging) { + console.log('>>> >>> render2d ==='); + console.log('>>> commands: ' + commands); + } + + callGCanvasLinkNative(componentId, 0x20000001, commands); + if(callback){ + callback(); + } + }, + + callExtendCallNative: isWeexIOS ? function (componentId, cmdArgs) { + + throw 'should not be here anymore ' + cmdArgs; + + } : function (componentId, cmdArgs) { + + throw 'should not be here anymore ' + cmdArgs; + + }, + + + flushNative: isWeexIOS ? function (componentId) { + + const cmdArgs = joinArray(commandsCache[componentId], ';'); + commandsCache[componentId] = []; + + if (isDebugging) { + console.log('>>> >>> flush native ==='); + console.log('>>> commands: ' + cmdArgs); + } + + const result = GCanvasModule.extendCallNative({ + "contextId": componentId, + "type": 0x60000000, + "args": cmdArgs + }); + + const res = result && result.result; + + if (isDebugging) { + console.log('>>> result: ' + res); + } + + return res; + + } : function (componentId) { + + const cmdArgs = joinArray(commandsCache[componentId], ';'); + commandsCache[componentId] = []; + + if (isDebugging) { + console.log('>>> >>> flush native ==='); + console.log('>>> commands: ' + cmdArgs); + } + + const result = callGCanvasLinkNative(componentId, 0x60000000, cmdArgs); + + if (isDebugging) { + console.log('>>> result: ' + result); + } + + return result; + }, + + callNative: function (componentId, cmdArgs, cache) { + + if (isDebugging) { + logCommand(componentId, cmdArgs); + } + + commandsCache[componentId].push(cmdArgs); + + if (!cache || isComboDisabled) { + return GBridge.flushNative(componentId); + } else { + return undefined; + } + }, + + texImage2D(componentId, ...args) { + if (isWeexIOS) { + if (args.length === 6) { + const [target, level, internalformat, format, type, image] = args; + GBridge.callNative( + componentId, + GLmethod.texImage2D + ',' + 6 + ',' + target + ',' + level + ',' + internalformat + ',' + format + ',' + type + ',' + image.src + ) + } else if (args.length === 9) { + const [target, level, internalformat, width, height, border, format, type, image] = args; + GBridge.callNative( + componentId, + GLmethod.texImage2D + ',' + 9 + ',' + target + ',' + level + ',' + internalformat + ',' + width + ',' + height + ',' + border + ',' + + + format + ',' + type + ',' + (image ? image.src : 0) + ) + } + } else if (isWeexAndroid) { + if (args.length === 6) { + const [target, level, internalformat, format, type, image] = args; + GCanvasModule.texImage2D(componentId, target, level, internalformat, format, type, image.src); + } else if (args.length === 9) { + const [target, level, internalformat, width, height, border, format, type, image] = args; + GCanvasModule.texImage2D(componentId, target, level, internalformat, width, height, border, format, type, (image ? image.src : 0)); + } + } + }, + + texSubImage2D(componentId, target, level, xoffset, yoffset, format, type, image) { + if (isWeexIOS) { + if (arguments.length === 8) { + GBridge.callNative( + componentId, + GLmethod.texSubImage2D + ',' + 6 + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset, + ',' + format + ',' + type + ',' + image.src + ) + } + } else if (isWeexAndroid) { + GCanvasModule.texSubImage2D(componentId, target, level, xoffset, yoffset, format, type, image.src); + } + }, + + bindImageTexture(componentId, src, imageId) { + GCanvasModule.bindImageTexture([src, imageId], componentId); + }, + + perloadImage([url, id], callback) { + GCanvasModule.preLoadImage([url, id], function (image) { + image.url = url; + image.id = id; + callback(image); + }); + }, + + measureText(text, fontStyle, componentId) { + return GCanvasModule.measureText([text, fontStyle], componentId); + }, + + getImageData (componentId, x, y, w, h, callback) { + GCanvasModule.getImageData([x, y,w,h],componentId,callback); + }, + + putImageData (componentId, data, x, y, w, h, callback) { + GCanvasModule.putImageData([x, y,w,h,data],componentId,callback); + }, + + toTempFilePath(componentId, x, y, width, height, destWidth, destHeight, fileType, quality, callback){ + GCanvasModule.toTempFilePath([x, y, width,height, destWidth, destHeight, fileType, quality], componentId, callback); + } +} + +export default GBridge; \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/context-2d/FillStyleLinearGradient.js b/components/firstui/fui-barcode/gcanvas/context-2d/FillStyleLinearGradient.js new file mode 100644 index 0000000..43f577f --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/context-2d/FillStyleLinearGradient.js @@ -0,0 +1,19 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 614 0 72 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +class FillStyleLinearGradient { + + constructor(x0, y0, x1, y1) { + this._start_pos = { _x: x0, _y: y0 }; + this._end_pos = { _x: x1, _y: y1 }; + this._stop_count = 0; + this._stops = [0, 0, 0, 0, 0]; + } + + addColorStop = function (pos, color) { + if (this._stop_count < 5 && 0.0 <= pos && pos <= 1.0) { + this._stops[this._stop_count] = { _pos: pos, _color: color }; + this._stop_count++; + } + } +} + +export default FillStyleLinearGradient; \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/context-2d/FillStylePattern.js b/components/firstui/fui-barcode/gcanvas/context-2d/FillStylePattern.js new file mode 100644 index 0000000..34b18db --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/context-2d/FillStylePattern.js @@ -0,0 +1,9 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8 6 140 72 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +class FillStylePattern { + constructor(img, pattern) { + this._style = pattern; + this._img = img; + } +} + +export default FillStylePattern; \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/context-2d/FillStyleRadialGradient.js b/components/firstui/fui-barcode/gcanvas/context-2d/FillStyleRadialGradient.js new file mode 100644 index 0000000..899e230 --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/context-2d/FillStyleRadialGradient.js @@ -0,0 +1,18 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 61 40 72 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +class FillStyleRadialGradient { + constructor(x0, y0, r0, x1, y1, r1) { + this._start_pos = { _x: x0, _y: y0, _r: r0 }; + this._end_pos = { _x: x1, _y: y1, _r: r1 }; + this._stop_count = 0; + this._stops = [0, 0, 0, 0, 0]; + } + + addColorStop(pos, color) { + if (this._stop_count < 5 && 0.0 <= pos && pos <= 1.0) { + this._stops[this._stop_count] = { _pos: pos, _color: color }; + this._stop_count++; + } + } +} + +export default FillStyleRadialGradient; \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/context-2d/RenderingContext.js b/components/firstui/fui-barcode/gcanvas/context-2d/RenderingContext.js new file mode 100644 index 0000000..77dfba5 --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/context-2d/RenderingContext.js @@ -0,0 +1,667 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 614 07 254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import FillStylePattern from './FillStylePattern'; +import FillStyleLinearGradient from './FillStyleLinearGradient'; +import FillStyleRadialGradient from './FillStyleRadialGradient'; +import GImage from '../env/image.js'; +import { + ArrayBufferToBase64, + Base64ToUint8ClampedArray +} from '../env/tool.js'; + +export default class CanvasRenderingContext2D { + + _drawCommands = ''; + + _globalAlpha = 1.0; + + _fillStyle = 'rgb(0,0,0)'; + _strokeStyle = 'rgb(0,0,0)'; + + _lineWidth = 1; + _lineCap = 'butt'; + _lineJoin = 'miter'; + + _miterLimit = 10; + + _globalCompositeOperation = 'source-over'; + + _textAlign = 'start'; + _textBaseline = 'alphabetic'; + + _font = '10px sans-serif'; + + _savedGlobalAlpha = []; + + timer = null; + componentId = null; + + _notCommitDrawImageCache = []; + _needRedrawImageCache = []; + _redrawCommands = ''; + _autoSaveContext = true; + // _imageMap = new GHashMap(); + // _textureMap = new GHashMap(); + + constructor() { + this.className = 'CanvasRenderingContext2D'; + //this.save() + } + + setFillStyle(value) { + this.fillStyle = value; + } + + set fillStyle(value) { + this._fillStyle = value; + + if (typeof(value) == 'string') { + this._drawCommands = this._drawCommands.concat("F" + value + ";"); + } else if (value instanceof FillStylePattern) { + const image = value._img; + if (!image.complete) { + image.onload = () => { + var index = this._needRedrawImageCache.indexOf(image); + if (index > -1) { + this._needRedrawImageCache.splice(index, 1); + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + this._redrawflush(true); + } + } + this._notCommitDrawImageCache.push(image); + } else { + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + } + + //CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + this._drawCommands = this._drawCommands.concat("G" + image._id + "," + value._style + ";"); + } else if (value instanceof FillStyleLinearGradient) { + var command = "D" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + + value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," + + value._stop_count; + for (var i = 0; i < value._stop_count; ++i) { + command += ("," + value._stops[i]._pos + "," + value._stops[i]._color); + } + this._drawCommands = this._drawCommands.concat(command + ";"); + } else if (value instanceof FillStyleRadialGradient) { + var command = "H" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + value._start_pos._r + .toFixed(2) + "," + + value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," + value._end_pos._r.toFixed(2) + "," + + value._stop_count; + for (var i = 0; i < value._stop_count; ++i) { + command += ("," + value._stops[i]._pos + "," + value._stops[i]._color); + } + this._drawCommands = this._drawCommands.concat(command + ";"); + } + } + + get fillStyle() { + return this._fillStyle; + } + + get globalAlpha() { + return this._globalAlpha; + } + + setGlobalAlpha(value) { + this.globalAlpha = value; + } + + set globalAlpha(value) { + this._globalAlpha = value; + this._drawCommands = this._drawCommands.concat("a" + value.toFixed(2) + ";"); + } + + + get strokeStyle() { + return this._strokeStyle; + } + + setStrokeStyle(value) { + this.strokeStyle = value; + } + + set strokeStyle(value) { + + this._strokeStyle = value; + + if (typeof(value) == 'string') { + this._drawCommands = this._drawCommands.concat("S" + value + ";"); + } else if (value instanceof FillStylePattern) { + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + this._drawCommands = this._drawCommands.concat("G" + image._id + "," + value._style + ";"); + } else if (value instanceof FillStyleLinearGradient) { + var command = "D" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + + value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," + + value._stop_count; + + for (var i = 0; i < value._stop_count; ++i) { + command += ("," + value._stops[i]._pos + "," + value._stops[i]._color); + } + this._drawCommands = this._drawCommands.concat(command + ";"); + } else if (value instanceof FillStyleRadialGradient) { + var command = "H" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + value._start_pos._r + .toFixed(2) + "," + + value._end_pos._x.toFixed(2) + "," + value._end_pos._y + ",".toFixed(2) + value._end_pos._r.toFixed(2) + "," + + value._stop_count; + + for (var i = 0; i < value._stop_count; ++i) { + command += ("," + value._stops[i]._pos + "," + value._stops[i]._color); + } + this._drawCommands = this._drawCommands.concat(command + ";"); + } + } + + get lineWidth() { + return this._lineWidth; + } + + setLineWidth(value) { + this.lineWidth = value; + } + + set lineWidth(value) { + this._lineWidth = value; + this._drawCommands = this._drawCommands.concat("W" + value + ";"); + } + + get lineCap() { + return this._lineCap; + } + + setLineCap(value) { + this.lineCap = value; + } + + set lineCap(value) { + this._lineCap = value; + this._drawCommands = this._drawCommands.concat("C" + value + ";"); + } + + get lineJoin() { + return this._lineJoin; + } + + setLineJoin(value) { + this.lineJoin = value + } + + set lineJoin(value) { + this._lineJoin = value; + this._drawCommands = this._drawCommands.concat("J" + value + ";"); + } + + get miterLimit() { + return this._miterLimit; + } + + setMiterLimit(value) { + this.miterLimit = value + } + + set miterLimit(value) { + this._miterLimit = value; + this._drawCommands = this._drawCommands.concat("M" + value + ";"); + } + + get globalCompositeOperation() { + return this._globalCompositeOperation; + } + + set globalCompositeOperation(value) { + + this._globalCompositeOperation = value; + let mode = 0; + switch (value) { + case "source-over": + mode = 0; + break; + case "source-atop": + mode = 5; + break; + case "source-in": + mode = 0; + break; + case "source-out": + mode = 2; + break; + case "destination-over": + mode = 4; + break; + case "destination-atop": + mode = 4; + break; + case "destination-in": + mode = 4; + break; + case "destination-out": + mode = 3; + break; + case "lighter": + mode = 1; + break; + case "copy": + mode = 2; + break; + case "xor": + mode = 6; + break; + default: + mode = 0; + } + + this._drawCommands = this._drawCommands.concat("B" + mode + ";"); + } + + get textAlign() { + return this._textAlign; + } + + setTextAlign(value) { + this.textAlign = value + } + + set textAlign(value) { + + this._textAlign = value; + let Align = 0; + switch (value) { + case "start": + Align = 0; + break; + case "end": + Align = 1; + break; + case "left": + Align = 2; + break; + case "center": + Align = 3; + break; + case "right": + Align = 4; + break; + default: + Align = 0; + } + + this._drawCommands = this._drawCommands.concat("A" + Align + ";"); + } + + get textBaseline() { + return this._textBaseline; + } + + setTextBaseline(value) { + this.textBaseline = value + } + + set textBaseline(value) { + this._textBaseline = value; + let baseline = 0; + switch (value) { + case "alphabetic": + baseline = 0; + break; + case "middle": + baseline = 1; + break; + case "top": + baseline = 2; + break; + case "hanging": + baseline = 3; + break; + case "bottom": + baseline = 4; + break; + case "ideographic": + baseline = 5; + break; + default: + baseline = 0; + break; + } + + this._drawCommands = this._drawCommands.concat("E" + baseline + ";"); + } + + get font() { + return this._font; + } + + setFontSize(size) { + var str = this._font; + var strs = str.trim().split(/\s+/); + for (var i = 0; i < strs.length; i++) { + var values = ["normal", "italic", "oblique", "normal", "small-caps", "normal", "bold", + "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900", + "normal", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", + "semi-expanded", "expanded", "extra-expanded", "ultra-expanded" + ]; + + if (-1 == values.indexOf(strs[i].trim())) { + if (typeof size === 'string') { + strs[i] = size; + } else if (typeof size === 'number') { + strs[i] = String(size) + 'px'; + } + break; + } + } + this.font = strs.join(" "); + } + + set font(value) { + this._font = value; + this._drawCommands = this._drawCommands.concat("j" + value + ";"); + } + + setTransform(a, b, c, d, tx, ty) { + this._drawCommands = this._drawCommands.concat("t" + + (a === 1 ? "1" : a.toFixed(2)) + "," + + (b === 0 ? "0" : b.toFixed(2)) + "," + + (c === 0 ? "0" : c.toFixed(2)) + "," + + (d === 1 ? "1" : d.toFixed(2)) + "," + tx.toFixed(2) + "," + ty.toFixed(2) + ";"); + } + + transform(a, b, c, d, tx, ty) { + this._drawCommands = this._drawCommands.concat("f" + + (a === 1 ? "1" : a.toFixed(2)) + "," + + (b === 0 ? "0" : b.toFixed(2)) + "," + + (c === 0 ? "0" : c.toFixed(2)) + "," + + (d === 1 ? "1" : d.toFixed(2)) + "," + tx + "," + ty + ";"); + } + + resetTransform() { + this._drawCommands = this._drawCommands.concat("m;"); + } + + scale(a, d) { + this._drawCommands = this._drawCommands.concat("k" + a.toFixed(2) + "," + + d.toFixed(2) + ";"); + } + + rotate(angle) { + this._drawCommands = this._drawCommands + .concat("r" + angle.toFixed(6) + ";"); + } + + translate(tx, ty) { + this._drawCommands = this._drawCommands.concat("l" + tx.toFixed(2) + "," + ty.toFixed(2) + ";"); + } + + save() { + this._savedGlobalAlpha.push(this._globalAlpha); + this._drawCommands = this._drawCommands.concat("v;"); + } + + restore() { + this._drawCommands = this._drawCommands.concat("e;"); + this._globalAlpha = this._savedGlobalAlpha.pop(); + } + + createPattern(img, pattern) { + if (typeof img === 'string') { + var imgObj = new GImage(); + imgObj.src = img; + img = imgObj; + } + return new FillStylePattern(img, pattern); + } + + createLinearGradient(x0, y0, x1, y1) { + return new FillStyleLinearGradient(x0, y0, x1, y1); + } + + createRadialGradient = function(x0, y0, r0, x1, y1, r1) { + return new FillStyleRadialGradient(x0, y0, r0, x1, y1, r1); + }; + + createCircularGradient = function(x0, y0, r0) { + return new FillStyleRadialGradient(x0, y0, 0, x0, y0, r0); + }; + + strokeRect(x, y, w, h) { + this._drawCommands = this._drawCommands.concat("s" + x + "," + y + "," + w + "," + h + ";"); + } + + + clearRect(x, y, w, h) { + this._drawCommands = this._drawCommands.concat("c" + x + "," + y + "," + w + + "," + h + ";"); + } + + clip() { + this._drawCommands = this._drawCommands.concat("p;"); + } + + resetClip() { + this._drawCommands = this._drawCommands.concat("q;"); + } + + closePath() { + this._drawCommands = this._drawCommands.concat("o;"); + } + + moveTo(x, y) { + this._drawCommands = this._drawCommands.concat("g" + x.toFixed(2) + "," + y.toFixed(2) + ";"); + } + + lineTo(x, y) { + this._drawCommands = this._drawCommands.concat("i" + x.toFixed(2) + "," + y.toFixed(2) + ";"); + } + + quadraticCurveTo = function(cpx, cpy, x, y) { + this._drawCommands = this._drawCommands.concat("u" + cpx + "," + cpy + "," + x + "," + y + ";"); + } + + bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, ) { + this._drawCommands = this._drawCommands.concat( + "z" + cp1x.toFixed(2) + "," + cp1y.toFixed(2) + "," + cp2x.toFixed(2) + "," + cp2y.toFixed(2) + "," + + x.toFixed(2) + "," + y.toFixed(2) + ";"); + } + + arcTo(x1, y1, x2, y2, radius) { + this._drawCommands = this._drawCommands.concat("h" + x1 + "," + y1 + "," + x2 + "," + y2 + "," + radius + ";"); + } + + beginPath() { + this._drawCommands = this._drawCommands.concat("b;"); + } + + + fillRect(x, y, w, h) { + this._drawCommands = this._drawCommands.concat("n" + x + "," + y + "," + w + + "," + h + ";"); + } + + rect(x, y, w, h) { + this._drawCommands = this._drawCommands.concat("w" + x + "," + y + "," + w + "," + h + ";"); + } + + fill() { + this._drawCommands = this._drawCommands.concat("L;"); + } + + stroke(path) { + this._drawCommands = this._drawCommands.concat("x;"); + } + + arc(x, y, radius, startAngle, endAngle, anticlockwise) { + + let ianticlockwise = 0; + if (anticlockwise) { + ianticlockwise = 1; + } + + this._drawCommands = this._drawCommands.concat( + "y" + x.toFixed(2) + "," + y.toFixed(2) + "," + + radius.toFixed(2) + "," + startAngle + "," + endAngle + "," + ianticlockwise + + ";" + ); + } + + fillText(text, x, y) { + let tmptext = text.replace(/!/g, "!!"); + tmptext = tmptext.replace(/,/g, "!,"); + tmptext = tmptext.replace(/;/g, "!;"); + this._drawCommands = this._drawCommands.concat("T" + tmptext + "," + x + "," + y + ",0.0;"); + } + + strokeText = function(text, x, y) { + let tmptext = text.replace(/!/g, "!!"); + tmptext = tmptext.replace(/,/g, "!,"); + tmptext = tmptext.replace(/;/g, "!;"); + this._drawCommands = this._drawCommands.concat("U" + tmptext + "," + x + "," + y + ",0.0;"); + } + + measureText(text) { + return CanvasRenderingContext2D.GBridge.measureText(text, this.font, this.componentId); + } + + isPointInPath = function(x, y) { + throw new Error('GCanvas not supported yet'); + } + + drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) { + if (typeof image === 'string') { + var imgObj = new GImage(); + imgObj.src = image; + image = imgObj; + } + if (image instanceof GImage) { + if (!image.complete) { + imgObj.onload = () => { + var index = this._needRedrawImageCache.indexOf(image); + if (index > -1) { + this._needRedrawImageCache.splice(index, 1); + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + this._redrawflush(true); + } + } + this._notCommitDrawImageCache.push(image); + } else { + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + } + var srcArgs = [image, sx, sy, sw, sh, dx, dy, dw, dh]; + var args = []; + for (var arg in srcArgs) { + if (typeof(srcArgs[arg]) != 'undefined') { + args.push(srcArgs[arg]); + } + } + this.__drawImage.apply(this, args); + //this.__drawImage(image,sx, sy, sw, sh, dx, dy, dw, dh); + } + } + + __drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) { + const numArgs = arguments.length; + + function drawImageCommands() { + + if (numArgs === 3) { + const x = parseFloat(sx) || 0.0; + const y = parseFloat(sy) || 0.0; + + return ("d" + image._id + ",0,0," + + image.width + "," + image.height + "," + + x + "," + y + "," + image.width + "," + image.height + ";"); + } else if (numArgs === 5) { + const x = parseFloat(sx) || 0.0; + const y = parseFloat(sy) || 0.0; + const width = parseInt(sw) || image.width; + const height = parseInt(sh) || image.height; + + return ("d" + image._id + ",0,0," + + image.width + "," + image.height + "," + + x + "," + y + "," + width + "," + height + ";"); + } else if (numArgs === 9) { + sx = parseFloat(sx) || 0.0; + sy = parseFloat(sy) || 0.0; + sw = parseInt(sw) || image.width; + sh = parseInt(sh) || image.height; + dx = parseFloat(dx) || 0.0; + dy = parseFloat(dy) || 0.0; + dw = parseInt(dw) || image.width; + dh = parseInt(dh) || image.height; + + return ("d" + image._id + "," + + sx + "," + sy + "," + sw + "," + sh + "," + + dx + "," + dy + "," + dw + "," + dh + ";"); + } + } + this._drawCommands += drawImageCommands(); + } + + _flush(reserve, callback) { + const commands = this._drawCommands; + this._drawCommands = ''; + CanvasRenderingContext2D.GBridge.render2d(this.componentId, commands, callback); + this._needRender = false; + } + + _redrawflush(reserve, callback) { + const commands = this._redrawCommands; + CanvasRenderingContext2D.GBridge.render2d(this.componentId, commands, callback); + if (this._needRedrawImageCache.length == 0) { + this._redrawCommands = ''; + } + } + + draw(reserve, callback) { + if (!reserve) { + this._globalAlpha = this._savedGlobalAlpha.pop(); + this._savedGlobalAlpha.push(this._globalAlpha); + this._redrawCommands = this._drawCommands; + this._needRedrawImageCache = this._notCommitDrawImageCache; + if (this._autoSaveContext) { + this._drawCommands = ("v;" + this._drawCommands); + this._autoSaveContext = false; + } else { + this._drawCommands = ("e;X;v;" + this._drawCommands); + } + } else { + this._needRedrawImageCache = this._needRedrawImageCache.concat(this._notCommitDrawImageCache); + this._redrawCommands += this._drawCommands; + if (this._autoSaveContext) { + this._drawCommands = ("v;" + this._drawCommands); + this._autoSaveContext = false; + } + } + this._notCommitDrawImageCache = []; + if (this._flush) { + this._flush(reserve, callback); + } + } + + getImageData(x, y, w, h, callback) { + CanvasRenderingContext2D.GBridge.getImageData(this.componentId, x, y, w, h, function(res) { + res.data = Base64ToUint8ClampedArray(res.data); + if (typeof(callback) == 'function') { + callback(res); + } + }); + } + + putImageData(data, x, y, w, h, callback) { + if (data instanceof Uint8ClampedArray) { + data = ArrayBufferToBase64(data); + CanvasRenderingContext2D.GBridge.putImageData(this.componentId, data, x, y, w, h, function(res) { + if (typeof(callback) == 'function') { + callback(res); + } + }); + } + } + + toTempFilePath(x, y, width, height, destWidth, destHeight, fileType, quality, callback) { + CanvasRenderingContext2D.GBridge.toTempFilePath(this.componentId, x, y, width, height, destWidth, destHeight, + fileType, quality, + function(res) { + if (typeof(callback) == 'function') { + callback(res); + } + }); + } +} \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/context-webgl/ActiveInfo.js b/components/firstui/fui-barcode/gcanvas/context-webgl/ActiveInfo.js new file mode 100644 index 0000000..460b694 --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/context-webgl/ActiveInfo.js @@ -0,0 +1,12 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8 6140 7 2 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +export default class WebGLActiveInfo { + className = 'WebGLActiveInfo'; + + constructor({ + type, name, size + }) { + this.type = type; + this.name = name; + this.size = size; + } +} \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/context-webgl/Buffer.js b/components/firstui/fui-barcode/gcanvas/context-webgl/Buffer.js new file mode 100644 index 0000000..dce232c --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/context-webgl/Buffer.js @@ -0,0 +1,22 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8 6 14 072 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLBuffer'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLBuffer { + className = name; + + constructor(id) { + this.id = id; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/context-webgl/Framebuffer.js b/components/firstui/fui-barcode/gcanvas/context-webgl/Framebuffer.js new file mode 100644 index 0000000..9f5add2 --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/context-webgl/Framebuffer.js @@ -0,0 +1,22 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 61 40 72 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLFrameBuffer'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLFramebuffer { + className = name; + + constructor(id) { + this.id = id; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/context-webgl/GLenum.js b/components/firstui/fui-barcode/gcanvas/context-webgl/GLenum.js new file mode 100644 index 0000000..c341a8e --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/context-webgl/GLenum.js @@ -0,0 +1,299 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 614 0 72 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +export default { + "DEPTH_BUFFER_BIT": 256, + "STENCIL_BUFFER_BIT": 1024, + "COLOR_BUFFER_BIT": 16384, + "POINTS": 0, + "LINES": 1, + "LINE_LOOP": 2, + "LINE_STRIP": 3, + "TRIANGLES": 4, + "TRIANGLE_STRIP": 5, + "TRIANGLE_FAN": 6, + "ZERO": 0, + "ONE": 1, + "SRC_COLOR": 768, + "ONE_MINUS_SRC_COLOR": 769, + "SRC_ALPHA": 770, + "ONE_MINUS_SRC_ALPHA": 771, + "DST_ALPHA": 772, + "ONE_MINUS_DST_ALPHA": 773, + "DST_COLOR": 774, + "ONE_MINUS_DST_COLOR": 775, + "SRC_ALPHA_SATURATE": 776, + "FUNC_ADD": 32774, + "BLEND_EQUATION": 32777, + "BLEND_EQUATION_RGB": 32777, + "BLEND_EQUATION_ALPHA": 34877, + "FUNC_SUBTRACT": 32778, + "FUNC_REVERSE_SUBTRACT": 32779, + "BLEND_DST_RGB": 32968, + "BLEND_SRC_RGB": 32969, + "BLEND_DST_ALPHA": 32970, + "BLEND_SRC_ALPHA": 32971, + "CONSTANT_COLOR": 32769, + "ONE_MINUS_CONSTANT_COLOR": 32770, + "CONSTANT_ALPHA": 32771, + "ONE_MINUS_CONSTANT_ALPHA": 32772, + "BLEND_COLOR": 32773, + "ARRAY_BUFFER": 34962, + "ELEMENT_ARRAY_BUFFER": 34963, + "ARRAY_BUFFER_BINDING": 34964, + "ELEMENT_ARRAY_BUFFER_BINDING": 34965, + "STREAM_DRAW": 35040, + "STATIC_DRAW": 35044, + "DYNAMIC_DRAW": 35048, + "BUFFER_SIZE": 34660, + "BUFFER_USAGE": 34661, + "CURRENT_VERTEX_ATTRIB": 34342, + "FRONT": 1028, + "BACK": 1029, + "FRONT_AND_BACK": 1032, + "TEXTURE_2D": 3553, + "CULL_FACE": 2884, + "BLEND": 3042, + "DITHER": 3024, + "STENCIL_TEST": 2960, + "DEPTH_TEST": 2929, + "SCISSOR_TEST": 3089, + "POLYGON_OFFSET_FILL": 32823, + "SAMPLE_ALPHA_TO_COVERAGE": 32926, + "SAMPLE_COVERAGE": 32928, + "NO_ERROR": 0, + "INVALID_ENUM": 1280, + "INVALID_VALUE": 1281, + "INVALID_OPERATION": 1282, + "OUT_OF_MEMORY": 1285, + "CW": 2304, + "CCW": 2305, + "LINE_WIDTH": 2849, + "ALIASED_POINT_SIZE_RANGE": 33901, + "ALIASED_LINE_WIDTH_RANGE": 33902, + "CULL_FACE_MODE": 2885, + "FRONT_FACE": 2886, + "DEPTH_RANGE": 2928, + "DEPTH_WRITEMASK": 2930, + "DEPTH_CLEAR_VALUE": 2931, + "DEPTH_FUNC": 2932, + "STENCIL_CLEAR_VALUE": 2961, + "STENCIL_FUNC": 2962, + "STENCIL_FAIL": 2964, + "STENCIL_PASS_DEPTH_FAIL": 2965, + "STENCIL_PASS_DEPTH_PASS": 2966, + "STENCIL_REF": 2967, + "STENCIL_VALUE_MASK": 2963, + "STENCIL_WRITEMASK": 2968, + "STENCIL_BACK_FUNC": 34816, + "STENCIL_BACK_FAIL": 34817, + "STENCIL_BACK_PASS_DEPTH_FAIL": 34818, + "STENCIL_BACK_PASS_DEPTH_PASS": 34819, + "STENCIL_BACK_REF": 36003, + "STENCIL_BACK_VALUE_MASK": 36004, + "STENCIL_BACK_WRITEMASK": 36005, + "VIEWPORT": 2978, + "SCISSOR_BOX": 3088, + "COLOR_CLEAR_VALUE": 3106, + "COLOR_WRITEMASK": 3107, + "UNPACK_ALIGNMENT": 3317, + "PACK_ALIGNMENT": 3333, + "MAX_TEXTURE_SIZE": 3379, + "MAX_VIEWPORT_DIMS": 3386, + "SUBPIXEL_BITS": 3408, + "RED_BITS": 3410, + "GREEN_BITS": 3411, + "BLUE_BITS": 3412, + "ALPHA_BITS": 3413, + "DEPTH_BITS": 3414, + "STENCIL_BITS": 3415, + "POLYGON_OFFSET_UNITS": 10752, + "POLYGON_OFFSET_FACTOR": 32824, + "TEXTURE_BINDING_2D": 32873, + "SAMPLE_BUFFERS": 32936, + "SAMPLES": 32937, + "SAMPLE_COVERAGE_VALUE": 32938, + "SAMPLE_COVERAGE_INVERT": 32939, + "COMPRESSED_TEXTURE_FORMATS": 34467, + "DONT_CARE": 4352, + "FASTEST": 4353, + "NICEST": 4354, + "GENERATE_MIPMAP_HINT": 33170, + "BYTE": 5120, + "UNSIGNED_BYTE": 5121, + "SHORT": 5122, + "UNSIGNED_SHORT": 5123, + "INT": 5124, + "UNSIGNED_INT": 5125, + "FLOAT": 5126, + "DEPTH_COMPONENT": 6402, + "ALPHA": 6406, + "RGB": 6407, + "RGBA": 6408, + "LUMINANCE": 6409, + "LUMINANCE_ALPHA": 6410, + "UNSIGNED_SHORT_4_4_4_4": 32819, + "UNSIGNED_SHORT_5_5_5_1": 32820, + "UNSIGNED_SHORT_5_6_5": 33635, + "FRAGMENT_SHADER": 35632, + "VERTEX_SHADER": 35633, + "MAX_VERTEX_ATTRIBS": 34921, + "MAX_VERTEX_UNIFORM_VECTORS": 36347, + "MAX_VARYING_VECTORS": 36348, + "MAX_COMBINED_TEXTURE_IMAGE_UNITS": 35661, + "MAX_VERTEX_TEXTURE_IMAGE_UNITS": 35660, + "MAX_TEXTURE_IMAGE_UNITS": 34930, + "MAX_FRAGMENT_UNIFORM_VECTORS": 36349, + "SHADER_TYPE": 35663, + "DELETE_STATUS": 35712, + "LINK_STATUS": 35714, + "VALIDATE_STATUS": 35715, + "ATTACHED_SHADERS": 35717, + "ACTIVE_UNIFORMS": 35718, + "ACTIVE_ATTRIBUTES": 35721, + "SHADING_LANGUAGE_VERSION": 35724, + "CURRENT_PROGRAM": 35725, + "NEVER": 512, + "LESS": 513, + "EQUAL": 514, + "LEQUAL": 515, + "GREATER": 516, + "NOTEQUAL": 517, + "GEQUAL": 518, + "ALWAYS": 519, + "KEEP": 7680, + "REPLACE": 7681, + "INCR": 7682, + "DECR": 7683, + "INVERT": 5386, + "INCR_WRAP": 34055, + "DECR_WRAP": 34056, + "VENDOR": 7936, + "RENDERER": 7937, + "VERSION": 7938, + "NEAREST": 9728, + "LINEAR": 9729, + "NEAREST_MIPMAP_NEAREST": 9984, + "LINEAR_MIPMAP_NEAREST": 9985, + "NEAREST_MIPMAP_LINEAR": 9986, + "LINEAR_MIPMAP_LINEAR": 9987, + "TEXTURE_MAG_FILTER": 10240, + "TEXTURE_MIN_FILTER": 10241, + "TEXTURE_WRAP_S": 10242, + "TEXTURE_WRAP_T": 10243, + "TEXTURE": 5890, + "TEXTURE_CUBE_MAP": 34067, + "TEXTURE_BINDING_CUBE_MAP": 34068, + "TEXTURE_CUBE_MAP_POSITIVE_X": 34069, + "TEXTURE_CUBE_MAP_NEGATIVE_X": 34070, + "TEXTURE_CUBE_MAP_POSITIVE_Y": 34071, + "TEXTURE_CUBE_MAP_NEGATIVE_Y": 34072, + "TEXTURE_CUBE_MAP_POSITIVE_Z": 34073, + "TEXTURE_CUBE_MAP_NEGATIVE_Z": 34074, + "MAX_CUBE_MAP_TEXTURE_SIZE": 34076, + "TEXTURE0": 33984, + "TEXTURE1": 33985, + "TEXTURE2": 33986, + "TEXTURE3": 33987, + "TEXTURE4": 33988, + "TEXTURE5": 33989, + "TEXTURE6": 33990, + "TEXTURE7": 33991, + "TEXTURE8": 33992, + "TEXTURE9": 33993, + "TEXTURE10": 33994, + "TEXTURE11": 33995, + "TEXTURE12": 33996, + "TEXTURE13": 33997, + "TEXTURE14": 33998, + "TEXTURE15": 33999, + "TEXTURE16": 34000, + "TEXTURE17": 34001, + "TEXTURE18": 34002, + "TEXTURE19": 34003, + "TEXTURE20": 34004, + "TEXTURE21": 34005, + "TEXTURE22": 34006, + "TEXTURE23": 34007, + "TEXTURE24": 34008, + "TEXTURE25": 34009, + "TEXTURE26": 34010, + "TEXTURE27": 34011, + "TEXTURE28": 34012, + "TEXTURE29": 34013, + "TEXTURE30": 34014, + "TEXTURE31": 34015, + "ACTIVE_TEXTURE": 34016, + "REPEAT": 10497, + "CLAMP_TO_EDGE": 33071, + "MIRRORED_REPEAT": 33648, + "FLOAT_VEC2": 35664, + "FLOAT_VEC3": 35665, + "FLOAT_VEC4": 35666, + "INT_VEC2": 35667, + "INT_VEC3": 35668, + "INT_VEC4": 35669, + "BOOL": 35670, + "BOOL_VEC2": 35671, + "BOOL_VEC3": 35672, + "BOOL_VEC4": 35673, + "FLOAT_MAT2": 35674, + "FLOAT_MAT3": 35675, + "FLOAT_MAT4": 35676, + "SAMPLER_2D": 35678, + "SAMPLER_CUBE": 35680, + "VERTEX_ATTRIB_ARRAY_ENABLED": 34338, + "VERTEX_ATTRIB_ARRAY_SIZE": 34339, + "VERTEX_ATTRIB_ARRAY_STRIDE": 34340, + "VERTEX_ATTRIB_ARRAY_TYPE": 34341, + "VERTEX_ATTRIB_ARRAY_NORMALIZED": 34922, + "VERTEX_ATTRIB_ARRAY_POINTER": 34373, + "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING": 34975, + "IMPLEMENTATION_COLOR_READ_TYPE": 35738, + "IMPLEMENTATION_COLOR_READ_FORMAT": 35739, + "COMPILE_STATUS": 35713, + "LOW_FLOAT": 36336, + "MEDIUM_FLOAT": 36337, + "HIGH_FLOAT": 36338, + "LOW_INT": 36339, + "MEDIUM_INT": 36340, + "HIGH_INT": 36341, + "FRAMEBUFFER": 36160, + "RENDERBUFFER": 36161, + "RGBA4": 32854, + "RGB5_A1": 32855, + "RGB565": 36194, + "DEPTH_COMPONENT16": 33189, + "STENCIL_INDEX8": 36168, + "DEPTH_STENCIL": 34041, + "RENDERBUFFER_WIDTH": 36162, + "RENDERBUFFER_HEIGHT": 36163, + "RENDERBUFFER_INTERNAL_FORMAT": 36164, + "RENDERBUFFER_RED_SIZE": 36176, + "RENDERBUFFER_GREEN_SIZE": 36177, + "RENDERBUFFER_BLUE_SIZE": 36178, + "RENDERBUFFER_ALPHA_SIZE": 36179, + "RENDERBUFFER_DEPTH_SIZE": 36180, + "RENDERBUFFER_STENCIL_SIZE": 36181, + "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE": 36048, + "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME": 36049, + "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL": 36050, + "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE": 36051, + "COLOR_ATTACHMENT0": 36064, + "DEPTH_ATTACHMENT": 36096, + "STENCIL_ATTACHMENT": 36128, + "DEPTH_STENCIL_ATTACHMENT": 33306, + "NONE": 0, + "FRAMEBUFFER_COMPLETE": 36053, + "FRAMEBUFFER_INCOMPLETE_ATTACHMENT": 36054, + "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT": 36055, + "FRAMEBUFFER_INCOMPLETE_DIMENSIONS": 36057, + "FRAMEBUFFER_UNSUPPORTED": 36061, + "FRAMEBUFFER_BINDING": 36006, + "RENDERBUFFER_BINDING": 36007, + "MAX_RENDERBUFFER_SIZE": 34024, + "INVALID_FRAMEBUFFER_OPERATION": 1286, + "UNPACK_FLIP_Y_WEBGL": 37440, + "UNPACK_PREMULTIPLY_ALPHA_WEBGL": 37441, + "CONTEXT_LOST_WEBGL": 37442, + "UNPACK_COLORSPACE_CONVERSION_WEBGL": 37443, + "BROWSER_DEFAULT_WEBGL": 37444 +}; \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/context-webgl/GLmethod.js b/components/firstui/fui-barcode/gcanvas/context-webgl/GLmethod.js new file mode 100644 index 0000000..bafa0b7 --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/context-webgl/GLmethod.js @@ -0,0 +1,143 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 61 4 07 2549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +let i = 1; + +const GLmethod = {}; + +GLmethod.activeTexture = i++; //1 +GLmethod.attachShader = i++; +GLmethod.bindAttribLocation = i++; +GLmethod.bindBuffer = i++; +GLmethod.bindFramebuffer = i++; +GLmethod.bindRenderbuffer = i++; +GLmethod.bindTexture = i++; +GLmethod.blendColor = i++; +GLmethod.blendEquation = i++; +GLmethod.blendEquationSeparate = i++; //10 +GLmethod.blendFunc = i++; +GLmethod.blendFuncSeparate = i++; +GLmethod.bufferData = i++; +GLmethod.bufferSubData = i++; +GLmethod.checkFramebufferStatus = i++; +GLmethod.clear = i++; +GLmethod.clearColor = i++; +GLmethod.clearDepth = i++; +GLmethod.clearStencil = i++; +GLmethod.colorMask = i++; //20 +GLmethod.compileShader = i++; +GLmethod.compressedTexImage2D = i++; +GLmethod.compressedTexSubImage2D = i++; +GLmethod.copyTexImage2D = i++; +GLmethod.copyTexSubImage2D = i++; +GLmethod.createBuffer = i++; +GLmethod.createFramebuffer = i++; +GLmethod.createProgram = i++; +GLmethod.createRenderbuffer = i++; +GLmethod.createShader = i++; //30 +GLmethod.createTexture = i++; +GLmethod.cullFace = i++; +GLmethod.deleteBuffer = i++; +GLmethod.deleteFramebuffer = i++; +GLmethod.deleteProgram = i++; +GLmethod.deleteRenderbuffer = i++; +GLmethod.deleteShader = i++; +GLmethod.deleteTexture = i++; +GLmethod.depthFunc = i++; +GLmethod.depthMask = i++; //40 +GLmethod.depthRange = i++; +GLmethod.detachShader = i++; +GLmethod.disable = i++; +GLmethod.disableVertexAttribArray = i++; +GLmethod.drawArrays = i++; +GLmethod.drawArraysInstancedANGLE = i++; +GLmethod.drawElements = i++; +GLmethod.drawElementsInstancedANGLE = i++; +GLmethod.enable = i++; +GLmethod.enableVertexAttribArray = i++; //50 +GLmethod.flush = i++; +GLmethod.framebufferRenderbuffer = i++; +GLmethod.framebufferTexture2D = i++; +GLmethod.frontFace = i++; +GLmethod.generateMipmap = i++; +GLmethod.getActiveAttrib = i++; +GLmethod.getActiveUniform = i++; +GLmethod.getAttachedShaders = i++; +GLmethod.getAttribLocation = i++; +GLmethod.getBufferParameter = i++; //60 +GLmethod.getContextAttributes = i++; +GLmethod.getError = i++; +GLmethod.getExtension = i++; +GLmethod.getFramebufferAttachmentParameter = i++; +GLmethod.getParameter = i++; +GLmethod.getProgramInfoLog = i++; +GLmethod.getProgramParameter = i++; +GLmethod.getRenderbufferParameter = i++; +GLmethod.getShaderInfoLog = i++; +GLmethod.getShaderParameter = i++; //70 +GLmethod.getShaderPrecisionFormat = i++; +GLmethod.getShaderSource = i++; +GLmethod.getSupportedExtensions = i++; +GLmethod.getTexParameter = i++; +GLmethod.getUniform = i++; +GLmethod.getUniformLocation = i++; +GLmethod.getVertexAttrib = i++; +GLmethod.getVertexAttribOffset = i++; +GLmethod.isBuffer = i++; +GLmethod.isContextLost = i++; //80 +GLmethod.isEnabled = i++; +GLmethod.isFramebuffer = i++; +GLmethod.isProgram = i++; +GLmethod.isRenderbuffer = i++; +GLmethod.isShader = i++; +GLmethod.isTexture = i++; +GLmethod.lineWidth = i++; +GLmethod.linkProgram = i++; +GLmethod.pixelStorei = i++; +GLmethod.polygonOffset = i++; //90 +GLmethod.readPixels = i++; +GLmethod.renderbufferStorage = i++; +GLmethod.sampleCoverage = i++; +GLmethod.scissor = i++; +GLmethod.shaderSource = i++; +GLmethod.stencilFunc = i++; +GLmethod.stencilFuncSeparate = i++; +GLmethod.stencilMask = i++; +GLmethod.stencilMaskSeparate = i++; +GLmethod.stencilOp = i++; //100 +GLmethod.stencilOpSeparate = i++; +GLmethod.texImage2D = i++; +GLmethod.texParameterf = i++; +GLmethod.texParameteri = i++; +GLmethod.texSubImage2D = i++; +GLmethod.uniform1f = i++; +GLmethod.uniform1fv = i++; +GLmethod.uniform1i = i++; +GLmethod.uniform1iv = i++; +GLmethod.uniform2f = i++; //110 +GLmethod.uniform2fv = i++; +GLmethod.uniform2i = i++; +GLmethod.uniform2iv = i++; +GLmethod.uniform3f = i++; +GLmethod.uniform3fv = i++; +GLmethod.uniform3i = i++; +GLmethod.uniform3iv = i++; +GLmethod.uniform4f = i++; +GLmethod.uniform4fv = i++; +GLmethod.uniform4i = i++; //120 +GLmethod.uniform4iv = i++; +GLmethod.uniformMatrix2fv = i++; +GLmethod.uniformMatrix3fv = i++; +GLmethod.uniformMatrix4fv = i++; +GLmethod.useProgram = i++; +GLmethod.validateProgram = i++; +GLmethod.vertexAttrib1f = i++; //new +GLmethod.vertexAttrib2f = i++; //new +GLmethod.vertexAttrib3f = i++; //new +GLmethod.vertexAttrib4f = i++; //new //130 +GLmethod.vertexAttrib1fv = i++; //new +GLmethod.vertexAttrib2fv = i++; //new +GLmethod.vertexAttrib3fv = i++; //new +GLmethod.vertexAttrib4fv = i++; //new +GLmethod.vertexAttribPointer = i++; +GLmethod.viewport = i++; + +export default GLmethod; \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/context-webgl/GLtype.js b/components/firstui/fui-barcode/gcanvas/context-webgl/GLtype.js new file mode 100644 index 0000000..9c66f9a --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/context-webgl/GLtype.js @@ -0,0 +1,23 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8 614072 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +const GLtype = {}; + +[ + "GLbitfield", + "GLboolean", + "GLbyte", + "GLclampf", + "GLenum", + "GLfloat", + "GLint", + "GLintptr", + "GLsizei", + "GLsizeiptr", + "GLshort", + "GLubyte", + "GLuint", + "GLushort" +].sort().map((typeName, i) => GLtype[typeName] = 1 >> (i + 1)); + +export default GLtype; + + diff --git a/components/firstui/fui-barcode/gcanvas/context-webgl/Program.js b/components/firstui/fui-barcode/gcanvas/context-webgl/Program.js new file mode 100644 index 0000000..5e78ebc --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/context-webgl/Program.js @@ -0,0 +1,22 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 614 0 725 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLProgram'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLProgram { + className = name; + + constructor(id) { + this.id = id; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/context-webgl/Renderbuffer.js b/components/firstui/fui-barcode/gcanvas/context-webgl/Renderbuffer.js new file mode 100644 index 0000000..32e9310 --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/context-webgl/Renderbuffer.js @@ -0,0 +1,22 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 614 0 7 254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLRenderBuffer'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLRenderbuffer { + className = name; + + constructor(id) { + this.id = id; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/context-webgl/RenderingContext.js b/components/firstui/fui-barcode/gcanvas/context-webgl/RenderingContext.js new file mode 100644 index 0000000..7c759fb --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/context-webgl/RenderingContext.js @@ -0,0 +1,1192 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8 614 07254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import GLenum from './GLenum'; +import ActiveInfo from './ActiveInfo'; +import Buffer from './Buffer'; +import Framebuffer from './Framebuffer'; +import Renderbuffer from './Renderbuffer'; +import Texture from './Texture'; +import Program from './Program'; +import Shader from './Shader'; +import ShaderPrecisionFormat from './ShaderPrecisionFormat'; +import UniformLocation from './UniformLocation'; +import GLmethod from './GLmethod'; + +const processArray = (array, checkArrayType = false) => { + + function joinArray(arr, sep) { + let res = ''; + for (let i = 0; i < arr.length; i++) { + if (i !== 0) { + res += sep; + } + res += arr[i]; + } + return res; + } + + let type = 'Float32Array'; + if (checkArrayType) { + if (array instanceof Uint8Array) { + type = 'Uint8Array' + } else if (array instanceof Uint16Array) { + type = 'Uint16Array'; + } else if (array instanceof Uint32Array) { + type = 'Uint32Array'; + } else if (array instanceof Float32Array) { + type = 'Float32Array'; + } else { + throw new Error('Check array type failed. Array type is ' + typeof array); + } + } + + const ArrayTypes = { + Uint8Array: 1, + Uint16Array: 2, + Uint32Array: 4, + Float32Array: 14 + }; + return ArrayTypes[type] + ',' + btoa(joinArray(array, ',')) +} + +export default class WebGLRenderingContext { + + // static GBridge = null; + + className = 'WebGLRenderingContext'; + + constructor(canvas, type, attrs) { + this._canvas = canvas; + this._type = type; + this._version = 'WebGL 1.0'; + this._attrs = attrs; + this._map = new Map(); + + Object.keys(GLenum) + .forEach(name => Object.defineProperty(this, name, { + value: GLenum[name] + })); + } + + get canvas() { + return this._canvas; + } + + activeTexture = function (textureUnit) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.activeTexture + ',' + textureUnit, + true + ); + } + + attachShader = function (progarm, shader) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.attachShader + ',' + progarm.id + ',' + shader.id, + true + ); + } + + bindAttribLocation = function (program, index, name) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindAttribLocation + ',' + program.id + ',' + index + ',' + name, + true + ) + } + + bindBuffer = function (target, buffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindBuffer + ',' + target + ',' + (buffer ? buffer.id : 0), + true + ); + } + + bindFramebuffer = function (target, framebuffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindFramebuffer + ',' + target + ',' + (framebuffer ? framebuffer.id : 0), + true + ) + } + + bindRenderbuffer = function (target, renderBuffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindRenderbuffer + ',' + target + ',' + (renderBuffer ? renderBuffer.id : 0), + true + ) + } + + bindTexture = function (target, texture) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindTexture + ',' + target + ',' + (texture ? texture.id : 0), + true + ) + } + + blendColor = function (r, g, b, a) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendColor + ',' + target + ',' + r + ',' + g + ',' + b + ',' + a, + true + ) + } + + blendEquation = function (mode) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendEquation + ',' + mode, + true + ) + } + + blendEquationSeparate = function (modeRGB, modeAlpha) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendEquationSeparate + ',' + modeRGB + ',' + modeAlpha, + true + ) + } + + + blendFunc = function (sfactor, dfactor) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendFunc + ',' + sfactor + ',' + dfactor, + true + ); + } + + blendFuncSeparate = function (srcRGB, dstRGB, srcAlpha, dstAlpha) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendFuncSeparate + ',' + srcRGB + ',' + dstRGB + ',' + srcAlpha + ',' + dstAlpha, + true + ); + } + + bufferData = function (target, data, usage) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bufferData + ',' + target + ',' + processArray(data, true) + ',' + usage, + true + ) + } + + bufferSubData = function (target, offset, data) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bufferSubData + ',' + target + ',' + offset + ',' + processArray(data, true), + true + ) + } + + checkFramebufferStatus = function (target) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.checkFramebufferStatus + ',' + target + ); + return Number(result); + } + + clear = function (mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.clear + ',' + mask + ); + this._canvas._needRender = true; + } + + clearColor = function (r, g, b, a) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.clearColor + ',' + r + ',' + g + ',' + b, + true + ) + } + + clearDepth = function (depth) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.clearDepth + ',' + depth, + true + ) + } + + clearStencil = function (s) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.clearStencil + ',' + s + ); + } + + colorMask = function (r, g, b, a) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.colorMask + ',' + r + ',' + g + ',' + b + ',' + a + ) + } + + compileShader = function (shader) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.compileShader + ',' + shader.id, + true + ) + } + + compressedTexImage2D = function (target, level, internalformat, width, height, border, pixels) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.compressedTexImage2D + ',' + target + ',' + level + ',' + internalformat + ',' + + width + ',' + height + ',' + border + ',' + processArray(pixels), + true + ) + } + + compressedTexSubImage2D = function (target, level, xoffset, yoffset, width, height, format, pixels) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.compressedTexSubImage2D + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset + ',' + + width + ',' + height + ',' + format + ',' + processArray(pixels), + true + ) + } + + + copyTexImage2D = function (target, level, internalformat, x, y, width, height, border) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.copyTexImage2D + ',' + target + ',' + level + ',' + internalformat + ',' + x + ',' + y + ',' + + width + ',' + height + ',' + border, + true + ); + } + + copyTexSubImage2D = function (target, level, xoffset, yoffset, x, y, width, height) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.copyTexSubImage2D + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset + ',' + x + ',' + y + ',' + + width + ',' + height + ); + } + + createBuffer = function () { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createBuffer + '' + ); + const buffer = new Buffer(result); + this._map.set(buffer.uuid(), buffer); + return buffer; + } + + createFramebuffer = function () { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createFramebuffer + '' + ); + const framebuffer = new Framebuffer(result); + this._map.set(framebuffer.uuid(), framebuffer); + return framebuffer; + } + + + createProgram = function () { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createProgram + '' + ); + const program = new Program(id); + this._map.set(program.uuid(), program); + return program; + } + + createRenderbuffer = function () { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createRenderbuffer + '' + ) + const renderBuffer = new Renderbuffer(id); + this._map.set(renderBuffer.uuid(), renderBuffer); + return renderBuffer; + } + + createShader = function (type) { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createShader + ',' + type + ) + const shader = new Shader(id, type); + this._map.set(shader.uuid(), shader); + return shader; + } + + createTexture = function () { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createTexture + '' + ); + const texture = new Texture(id); + this._map.set(texture.uuid(), texture); + return texture; + } + + cullFace = function (mode) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.cullFace + ',' + mode, + true + ) + } + + + deleteBuffer = function (buffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteBuffer + ',' + buffer.id, + true + ) + } + + deleteFramebuffer = function (framebuffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteFramebuffer + ',' + framebuffer.id, + true + ) + } + + deleteProgram = function (program) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteProgram + ',' + program.id, + true + ) + } + + deleteRenderbuffer = function (renderbuffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteRenderbuffer + ',' + renderbuffer.id, + true + ) + } + + deleteShader = function (shader) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteShader + ',' + shader.id, + true + ) + } + + deleteTexture = function (texture) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteTexture + ',' + texture.id, + true + ) + } + + depthFunc = function (func) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.depthFunc + ',' + func + ) + } + + depthMask = function (flag) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.depthMask + ',' + Number(flag), + true + ) + } + + depthRange = function (zNear, zFar) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.depthRange + ',' + zNear + ',' + zFar, + true + ) + } + + detachShader = function (program, shader) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.detachShader + ',' + program.id + ',' + shader.id, + true + ) + } + + disable = function (cap) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.disable + ',' + cap, + true + ) + } + + disableVertexAttribArray = function (index) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.disableVertexAttribArray + ',' + index, + true + ); + } + + drawArrays = function (mode, first, count) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.drawArrays + ',' + mode + ',' + first + ',' + count + ) + this._canvas._needRender = true; + } + + drawElements = function (mode, count, type, offset) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.drawElements + ',' + mode + ',' + count + ',' + type + ',' + offset + ';' + ); + this._canvas._needRender = true; + } + + enable = function (cap) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.enable + ',' + cap, + true + ); + } + + enableVertexAttribArray = function (index) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.enableVertexAttribArray + ',' + index, + true + ) + } + + + flush = function () { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.flush + '' + ) + } + + framebufferRenderbuffer = function (target, attachment, textarget, texture, level) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.framebufferRenderbuffer + ',' + target + ',' + attachment + ',' + textarget + ',' + (texture ? texture.id : 0) + ',' + level, + true + ) + } + + framebufferTexture2D = function (target, attachment, textarget, texture, level) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.framebufferTexture2D + ',' + target + ',' + attachment + ',' + textarget + ',' + (texture ? texture.id : 0) + ',' + level, + true + ) + } + + frontFace = function (mode) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.frontFace + ',' + mode, + true + ) + } + + generateMipmap = function (target) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.generateMipmap + ',' + target, + true + ) + } + + getActiveAttrib = function (progarm, index) { + const resultString = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getActiveAttrib + ',' + progarm.id + ',' + index + ) + const [type, size, name] = resultString.split(','); + return new ActiveInfo({ + type: Number(type), + size: Number(size), + name + }); + } + + getActiveUniform = function (progarm, index) { + const resultString = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getActiveUniform + ',' + progarm.id + ',' + index + ); + const [type, size, name] = resultString.split(','); + return new ActiveInfo({ + type: Number(type), + size: Number(size), + name + }) + } + + getAttachedShaders = function (progarm) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getAttachedShaders + ',' + progarm.id + ); + const [type, ...ids] = result; + return ids.map(id => this._map.get(Shader.uuid(id))); + } + + getAttribLocation = function (progarm, name) { + return WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getAttribLocation + ',' + progarm.id + ',' + name + ) + } + + getBufferParameter = function (target, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getBufferParameter + ',' + target + ',' + pname + ); + const [type, res] = getBufferParameter; + return res; + } + + getError = function () { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getError + '' + ) + return result; + } + + getExtension = function (name) { + return null; + } + + getFramebufferAttachmentParameter = function (target, attachment, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getFramebufferAttachmentParameter + ',' + target + ',' + attachment + ',' + pname + ) + switch (pname) { + case GLenum.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: + return this._map.get(Renderbuffer.uuid(result)) || this._map.get(Texture.uuid(result)) || null; + default: + return result; + } + } + + getParameter = function (pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getParameter + ',' + pname + ) + switch (pname) { + case GLenum.VERSION: + return this._version; + case GLenum.ARRAY_BUFFER_BINDING: // buffer + case GLenum.ELEMENT_ARRAY_BUFFER_BINDING: // buffer + return this._map.get(Buffer.uuid(result)) || null; + case GLenum.CURRENT_PROGRAM: // program + return this._map.get(Program.uuid(result)) || null; + case GLenum.FRAMEBUFFER_BINDING: // framebuffer + return this._map.get(Framebuffer.uuid(result)) || null; + case GLenum.RENDERBUFFER_BINDING: // renderbuffer + return this._map.get(Renderbuffer.uuid(result)) || null; + case GLenum.TEXTURE_BINDING_2D: // texture + case GLenum.TEXTURE_BINDING_CUBE_MAP: // texture + return this._map.get(Texture.uuid(result)) || null; + case GLenum.ALIASED_LINE_WIDTH_RANGE: // Float32Array + case GLenum.ALIASED_POINT_SIZE_RANGE: // Float32Array + case GLenum.BLEND_COLOR: // Float32Array + case GLenum.COLOR_CLEAR_VALUE: // Float32Array + case GLenum.DEPTH_RANGE: // Float32Array + case GLenum.MAX_VIEWPORT_DIMS: // Int32Array + case GLenum.SCISSOR_BOX: // Int32Array + case GLenum.VIEWPORT: // Int32Array + case GLenum.COMPRESSED_TEXTURE_FORMATS: // Uint32Array + default: + const [type, ...res] = result.split(','); + if (res.length === 1) { + return Number(res[0]); + } else { + return res.map(Number); + } + } + } + + getProgramInfoLog = function (progarm) { + return WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getProgramInfoLog + ',' + progarm.id + ) + } + + getProgramParameter = function (program, pname) { + const res = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getProgramParameter + ',' + program.id + ',' + pname + ); + + const [type, result] = res.split(',').map(i => parseInt(i)); + + if (type === 1) { + return Boolean(result); + } else if (type === 2) { + return result; + } else { + throw new Error('Unrecongized program paramater ' + res + ', type: ' + typeof res); + } + } + + + getRenderbufferParameter = function (target, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getRenderbufferParameter + ',' + target + ',' + pname + ) + return result; + } + + + getShaderInfoLog = function (shader) { + return WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getShaderInfoLog + ',' + shader.id + ); + } + + getShaderParameter = function (shader, pname) { + return WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getShaderParameter + ',' + shader.id + ',' + pname + ) + } + + getShaderPrecisionFormat = function (shaderType, precisionType) { + const [rangeMin, rangeMax, precision] = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getShaderPrecisionFormat + ',' + shaderType + ',' + precisionType + ); + const shaderPrecisionFormat = new ShaderPrecisionFormat({ + rangeMin: Number(rangeMin), + rangeMax: Number(rangeMax), + precision: Number(precision) + }); + return shaderPrecisionFormat; + } + + getShaderSource = function (shader) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getShaderSource + ',' + shader.id + ); + return result; + } + + getSupportedExtensions = function () { + return Object.keys({}); + } + + getTexParameter = function (target, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getTexParameter + ',' + target + ',' + pname + ) + return result; + } + + getUniformLocation = function (program, name) { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getUniformLocation + ',' + program.id + ',' + name + ); + if (id === -1) { + return null; + } else { + return new UniformLocation(Number(id)); + } + } + + getVertexAttrib = function (index, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getVertexAttrib + ',' + index + ',' + pname + ); + switch (pname) { + case GLenum.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: + return this._map.get(Buffer.uuid(result)) || null; + case GLenum.CURRENT_VERTEX_ATTRIB: // Float32Array + default: + return result; + } + } + + getVertexAttribOffset = function (index, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getVertexAttribOffset + ',' + index + ',' + pname + ) + return Number(result); + } + + isBuffer = function (buffer) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isBuffer + ',' + buffer.id + ) + return Boolean(result); + } + + isContextLost = function () { + return false; + } + + isEnabled = function (cap) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isEnabled + ',' + cap + ) + return Boolean(result); + } + + isFramebuffer = function (framebuffer) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isFramebuffer + ',' + framebuffer.id + ) + return Boolean(result); + } + + isProgram = function (program) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isProgram + ',' + program.id + ) + return Boolean(result); + } + + isRenderbuffer = function (renderBuffer) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isRenderbuffer + ',' + renderbuffer.id + ) + return Boolean(result); + } + + isShader = function (shader) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isShader + ',' + shader.id + ) + return Boolean(result); + } + + isTexture = function (texture) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isTexture + ',' + texture.id + ); + return Boolean(result); + } + + lineWidth = function (width) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.lineWidth + ',' + width, + true + ) + } + + linkProgram = function (program) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.linkProgram + ',' + program.id, + true + ); + } + + + pixelStorei = function (pname, param) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.pixelStorei + ',' + pname + ',' + Number(param) + ) + } + + polygonOffset = function (factor, units) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.polygonOffset + ',' + factor + ',' + units + ) + } + + readPixels = function (x, y, width, height, format, type, pixels) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.readPixels + ',' + x + ',' + y + ',' + width + ',' + height + ',' + format + ',' + type + ) + return result; + } + + renderbufferStorage = function (target, internalFormat, width, height) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.renderbufferStorage + ',' + target + ',' + internalFormat + ',' + width + ',' + height, + true + ) + } + + sampleCoverage = function (value, invert) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.sampleCoverage + ',' + value + ',' + Number(invert), + true + ) + } + + scissor = function (x, y, width, height) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.scissor + ',' + x + ',' + y + ',' + width + ',' + height, + true + ) + } + + shaderSource = function (shader, source) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.shaderSource + ',' + shader.id + ',' + source + ) + } + + stencilFunc = function (func, ref, mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilFunc + ',' + func + ',' + ref + ',' + mask, + true + ) + } + + stencilFuncSeparate = function (face, func, ref, mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilFuncSeparate + ',' + face + ',' + func + ',' + ref + ',' + mask, + true + ) + } + + stencilMask = function (mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilMask + ',' + mask, + true + ) + } + + stencilMaskSeparate = function (face, mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilMaskSeparate + ',' + face + ',' + mask, + true + ) + } + + stencilOp = function (fail, zfail, zpass) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilOp + ',' + fail + ',' + zfail + ',' + zpass + ) + } + + stencilOpSeparate = function (face, fail, zfail, zpass) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilOp + ',' + face + ',' + fail + ',' + zfail + ',' + zpass, + true + ) + } + + texImage2D = function (...args) { + WebGLRenderingContext.GBridge.texImage2D(this._canvas.id, ...args); + } + + + texParameterf = function (target, pname, param) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.texParameterf + ',' + target + ',' + pname + ',' + param, + true + ) + } + + texParameteri = function (target, pname, param) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.texParameteri + ',' + target + ',' + pname + ',' + param + ) + } + + texSubImage2D = function (...args) { + WebGLRenderingContext.GBridge.texSubImage2D(this._canvas.id, ...args); + } + + uniform1f = function (location, v0) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform1f + ',' + location.id + ',' + v0 + ) + } + + uniform1fv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform1fv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform1i = function (location, v0) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform1i + ',' + location.id + ',' + v0, + // true + ) + } + + uniform1iv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform1iv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform2f = function (location, v0, v1) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform2f + ',' + location.id + ',' + v0 + ',' + v1, + true + ) + } + + uniform2fv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform2fv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform2i = function (location, v0, v1) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform2i + ',' + location.id + ',' + v0 + ',' + v1, + true + ) + } + + uniform2iv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform2iv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform3f = function (location, v0, v1, v2) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform3f + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2, + true + ) + } + + uniform3fv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform3fv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform3i = function (location, v0, v1, v2) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform3i + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2, + true + ) + } + + uniform3iv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform3iv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform4f = function (location, v0, v1, v2, v3) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform4f + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2 + ',' + v3, + true + ) + } + + uniform4fv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform4fv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform4i = function (location, v0, v1, v2, v3) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform4i + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2 + ',' + v3, + true + ) + } + + uniform4iv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform4iv + ',' + location.id + ',' + processArray(value, true), + true + ) + } + + uniformMatrix2fv = function (location, transpose, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniformMatrix2fv + ',' + location.id + ',' + Number(transpose) + ',' + processArray(value), + true + ) + } + + uniformMatrix3fv = function (location, transpose, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniformMatrix3fv + ',' + location.id + ',' + Number(transpose) + ',' + processArray(value), + true + ) + } + + uniformMatrix4fv = function (location, transpose, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniformMatrix4fv + ',' + location.id + ',' + Number(transpose) + ',' + processArray(value), + true + ); + } + + useProgram = function (progarm) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.useProgram + ',' + progarm.id + '', + true + ) + } + + + validateProgram = function (program) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.validateProgram + ',' + program.id, + true + ) + } + + vertexAttrib1f = function (index, v0) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib1f + ',' + index + ',' + v0, + true + ) + } + + vertexAttrib2f = function (index, v0, v1) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib2f + ',' + index + ',' + v0 + ',' + v1, + true + ) + } + + vertexAttrib3f = function (index, v0, v1, v2) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib3f + ',' + index + ',' + v0 + ',' + v1 + ',' + v2, + true + ) + } + + vertexAttrib4f = function (index, v0, v1, v2, v3) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib4f + ',' + index + ',' + v0 + ',' + v1 + ',' + v2 + ',' + v3, + true + ) + } + + vertexAttrib1fv = function (index, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib1fv + ',' + index + ',' + processArray(value), + true + ) + } + + vertexAttrib2fv = function (index, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib2fv + ',' + index + ',' + processArray(value), + true + ) + } + + vertexAttrib3fv = function (index, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib3fv + ',' + index + ',' + processArray(value), + true + ) + } + + vertexAttrib4fv = function (index, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib4fv + ',' + index + ',' + processArray(value), + true + ) + } + + vertexAttribPointer = function (index, size, type, normalized, stride, offset) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttribPointer + ',' + index + ',' + size + ',' + type + ',' + Number(normalized) + ',' + stride + ',' + offset, + true + ) + } + + viewport = function (x, y, width, height) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.viewport + ',' + x + ',' + y + ',' + width + ',' + height, + true + ) + } +} \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/context-webgl/Shader.js b/components/firstui/fui-barcode/gcanvas/context-webgl/Shader.js new file mode 100644 index 0000000..a495611 --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/context-webgl/Shader.js @@ -0,0 +1,23 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 61 40725 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLShader'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLShader { + className = name; + + constructor(id, type) { + this.id = id; + this.type = type; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/context-webgl/ShaderPrecisionFormat.js b/components/firstui/fui-barcode/gcanvas/context-webgl/ShaderPrecisionFormat.js new file mode 100644 index 0000000..89492d8 --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/context-webgl/ShaderPrecisionFormat.js @@ -0,0 +1,12 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1861 4 0 72 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +export default class WebGLShaderPrecisionFormat { + className = 'WebGLShaderPrecisionFormat'; + + constructor({ + rangeMin, rangeMax, precision + }) { + this.rangeMin = rangeMin; + this.rangeMax = rangeMax; + this.precision = precision; + } +} \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/context-webgl/Texture.js b/components/firstui/fui-barcode/gcanvas/context-webgl/Texture.js new file mode 100644 index 0000000..e32caeb --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/context-webgl/Texture.js @@ -0,0 +1,23 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 61 40 72 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLTexture'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLTexture { + className = name; + + constructor(id, type) { + this.id = id; + this.type = type; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/context-webgl/UniformLocation.js b/components/firstui/fui-barcode/gcanvas/context-webgl/UniformLocation.js new file mode 100644 index 0000000..2fdc364 --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/context-webgl/UniformLocation.js @@ -0,0 +1,23 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 86 14 0 7 2549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLUniformLocation'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLUniformLocation { + className = name; + + constructor(id, type) { + this.id = id; + this.type = type; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/context-webgl/classUtils.js b/components/firstui/fui-barcode/gcanvas/context-webgl/classUtils.js new file mode 100644 index 0000000..b9d28a4 --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/context-webgl/classUtils.js @@ -0,0 +1,4 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 6140 7 2 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +export function getTransferedObjectUUID(name, id) { + return `${name.toLowerCase()}-${id}`; +} \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/env/canvas.js b/components/firstui/fui-barcode/gcanvas/env/canvas.js new file mode 100644 index 0000000..97d3b6e --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/env/canvas.js @@ -0,0 +1,75 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 186 140 72 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import GContext2D from '../context-2d/RenderingContext'; +import GContextWebGL from '../context-webgl/RenderingContext'; + +export default class GCanvas { + + // static GBridge = null; + + id = null; + + _needRender = true; + + constructor(id, { disableAutoSwap }) { + this.id = id; + + this._disableAutoSwap = disableAutoSwap; + if (disableAutoSwap) { + this._swapBuffers = () => { + GCanvas.GBridge.render(this.id); + } + } + } + + getContext(type) { + + let context = null; + + if (type.match(/webgl/i)) { + context = new GContextWebGL(this); + + context.componentId = this.id; + + if (!this._disableAutoSwap) { + const render = () => { + if (this._needRender) { + GCanvas.GBridge.render(this.id); + this._needRender = false; + } + } + setInterval(render, 16); + } + + GCanvas.GBridge.callSetContextType(this.id, 1); // 0 for 2d; 1 for webgl + } else if (type.match(/2d/i)) { + context = new GContext2D(this); + + context.componentId = this.id; + +// const render = ( callback ) => { +// +// const commands = context._drawCommands; +// context._drawCommands = ''; +// +// GCanvas.GBridge.render2d(this.id, commands, callback); +// this._needRender = false; +// } +// //draw方法触发 +// context._flush = render; +// //setInterval(render, 16); + + GCanvas.GBridge.callSetContextType(this.id, 0); + } else { + throw new Error('not supported context ' + type); + } + + return context; + + } + + reset() { + GCanvas.GBridge.callReset(this.id); + } + + +} \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/env/image.js b/components/firstui/fui-barcode/gcanvas/env/image.js new file mode 100644 index 0000000..b205807 --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/env/image.js @@ -0,0 +1,97 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:186 14 0 7 2 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +let incId = 1; + +const noop = function () { }; + +class GImage { + + static GBridge = null; + + constructor() { + this._id = incId++; + this._width = 0; + this._height = 0; + this._src = undefined; + this._onload = noop; + this._onerror = noop; + this.complete = false; + } + + get width() { + return this._width; + } + set width(v) { + this._width = v; + } + + get height() { + return this._height; + } + + set height(v) { + this._height = v; + } + + get src() { + return this._src; + } + + set src(v) { + + if (v.startsWith('//')) { + v = 'http:' + v; + } + + this._src = v; + + GImage.GBridge.perloadImage([this._src, this._id], (data) => { + if (typeof data === 'string') { + data = JSON.parse(data); + } + if (data.error) { + var evt = { type: 'error', target: this }; + this.onerror(evt); + } else { + this.complete = true; + this.width = typeof data.width === 'number' ? data.width : 0; + this.height = typeof data.height === 'number' ? data.height : 0; + var evt = { type: 'load', target: this }; + this.onload(evt); + } + }); + } + + addEventListener(name, listener) { + if (name === 'load') { + this.onload = listener; + } else if (name === 'error') { + this.onerror = listener; + } + } + + removeEventListener(name, listener) { + if (name === 'load') { + this.onload = noop; + } else if (name === 'error') { + this.onerror = noop; + } + } + + get onload() { + return this._onload; + } + + set onload(v) { + this._onload = v; + } + + get onerror() { + return this._onerror; + } + + set onerror(v) { + this._onerror = v; + } +} + +export default GImage; \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/env/tool.js b/components/firstui/fui-barcode/gcanvas/env/tool.js new file mode 100644 index 0000000..29cf714 --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/env/tool.js @@ -0,0 +1,25 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 86 14 072549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 + +export function ArrayBufferToBase64 (buffer) { + var binary = ''; + var bytes = new Uint8ClampedArray(buffer); + for (var len = bytes.byteLength, i = 0; i < len; i++) { + binary += String.fromCharCode(bytes[i]); + } + return btoa(binary); +} + +export function Base64ToUint8ClampedArray(base64String) { + const padding = '='.repeat((4 - base64String.length % 4) % 4); + const base64 = (base64String + padding) + .replace(/\-/g, '+') + .replace(/_/g, '/'); + + const rawData = atob(base64); + const outputArray = new Uint8ClampedArray(rawData.length); + + for (let i = 0; i < rawData.length; ++i) { + outputArray[i] = rawData.charCodeAt(i); + } + return outputArray; +} \ No newline at end of file diff --git a/components/firstui/fui-barcode/gcanvas/index.js b/components/firstui/fui-barcode/gcanvas/index.js new file mode 100644 index 0000000..d1e9fd2 --- /dev/null +++ b/components/firstui/fui-barcode/gcanvas/index.js @@ -0,0 +1,48 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 8 614 07254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import GCanvas from './env/canvas'; +import GImage from './env/image'; + +import GWebGLRenderingContext from './context-webgl/RenderingContext';// 2021-5-6变更 +import GContext2D from './context-2d/RenderingContext';// 新特性待增加 + +import GBridgeWeex from './bridge/bridge-weex'; + +export let Image = GImage; + +export let WeexBridge = GBridgeWeex; + +export function enable(el, { + bridge, + debug, + disableAutoSwap, + disableComboCommands +} = {}) { + + const GBridge = GImage.GBridge = GCanvas.GBridge = GWebGLRenderingContext.GBridge = GContext2D.GBridge = bridge; + + GBridge.callEnable(el.ref, [ + 0, // renderMode: 0--RENDERMODE_WHEN_DIRTY, 1--RENDERMODE_CONTINUOUSLY + -1, // hybridLayerType: 0--LAYER_TYPE_NONE 1--LAYER_TYPE_SOFTWARE 2--LAYER_TYPE_HARDWARE + false, // supportScroll + false, // newCanvasMode + 1, // compatible// echo建议 + 'white', // clearColor + false // sameLevel: newCanvasMode = true && true => GCanvasView and Webview is same level + ]); + + if (debug === true) { + GBridge.callEnableDebug();// todo: 待修改 + } + if (disableComboCommands) { + GBridge.callEnableDisableCombo(); + } +// todo: 待修改 + var canvas = new GCanvas(el.ref, { + disableAutoSwap + }); + let pixelRatio = uni.getSystemInfoSync().pixelRatio; + canvas.width = el.style.width * pixelRatio; + canvas.height = el.style.height * pixelRatio; + + return canvas; +}; \ No newline at end of file diff --git a/components/firstui/fui-bottom-navbar/fui-bottom-navbar.vue b/components/firstui/fui-bottom-navbar/fui-bottom-navbar.vue new file mode 100644 index 0000000..b4a86a3 --- /dev/null +++ b/components/firstui/fui-bottom-navbar/fui-bottom-navbar.vue @@ -0,0 +1,276 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-bottom-popup/fui-bottom-popup.vue b/components/firstui/fui-bottom-popup/fui-bottom-popup.vue new file mode 100644 index 0000000..003b41d --- /dev/null +++ b/components/firstui/fui-bottom-popup/fui-bottom-popup.vue @@ -0,0 +1,252 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-bubble-box/fui-bubble-box.vue b/components/firstui/fui-bubble-box/fui-bubble-box.vue new file mode 100644 index 0000000..ad3a1bb --- /dev/null +++ b/components/firstui/fui-bubble-box/fui-bubble-box.vue @@ -0,0 +1,520 @@ + + + + + \ No newline at end of file diff --git a/components/firstui/fui-button/fui-button.vue b/components/firstui/fui-button/fui-button.vue new file mode 100644 index 0000000..0237759 --- /dev/null +++ b/components/firstui/fui-button/fui-button.vue @@ -0,0 +1,525 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-calendar/fui-calendar.vue b/components/firstui/fui-calendar/fui-calendar.vue new file mode 100644 index 0000000..26f5e31 --- /dev/null +++ b/components/firstui/fui-calendar/fui-calendar.vue @@ -0,0 +1,906 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-calendar/index.js b/components/firstui/fui-calendar/index.js new file mode 100644 index 0000000..be841f9 --- /dev/null +++ b/components/firstui/fui-calendar/index.js @@ -0,0 +1,580 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1861 4 0 72 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +/** + * @1900-2100区间内的公历、农历互转 + * @公历转农历:solar2lunar(1987,11,01); + * @农历转公历:lunar2solar(1987,09,10); + */ +let calendar = { + /** + * 农历1900-2100的润大小信息表 + * @Array Of Property + * @return Hex + */ + lunarInfo: [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, + 0x055d2, //1900-1909 + 0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, //1910-1919 + 0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, //1920-1929 + 0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, //1930-1939 + 0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, //1940-1949 + 0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0, //1950-1959 + 0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, //1960-1969 + 0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6, //1970-1979 + 0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, //1980-1989 + 0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x055c0, 0x0ab60, 0x096d5, 0x092e0, //1990-1999 + 0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, //2000-2009 + 0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, //2010-2019 + 0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, //2020-2029 + 0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, //2030-2039 + 0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0, //2040-2049 + 0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0, //2050-2059 + 0x0a2e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4, //2060-2069 + 0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0, //2070-2079 + 0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160, //2080-2089 + 0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252, //2090-2099 + 0x0d520 + ], //2100 + /** + * 公历每个月份的天数普通表 + * @Array Of Property + * @return Number + */ + solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], + /** + * 天干地支之天干速查表 + * @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"] + * @return Cn string + */ + Gan: ["\u7532", "\u4e59", "\u4e19", "\u4e01", "\u620a", "\u5df1", "\u5e9a", "\u8f9b", "\u58ec", "\u7678"], + /** + * 天干地支之地支速查表 + * @Array Of Property + * @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"] + * @return Cn string + */ + Zhi: ["\u5b50", "\u4e11", "\u5bc5", "\u536f", "\u8fb0", "\u5df3", "\u5348", "\u672a", "\u7533", "\u9149", + "\u620c", + "\u4ea5" + ], + /** + * 天干地支之地支速查表<=>生肖 + * @Array Of Property + * @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"] + * @return Cn string + */ + Animals: ["\u9f20", "\u725b", "\u864e", "\u5154", "\u9f99", "\u86c7", "\u9a6c", "\u7f8a", "\u7334", "\u9e21", + "\u72d7", "\u732a" + ], + /** + * 24节气速查表 + * @Array Of Property + * @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"] + * @return Cn string + */ + solarTerm: ["\u5c0f\u5bd2", "\u5927\u5bd2", "\u7acb\u6625", "\u96e8\u6c34", "\u60ca\u86f0", "\u6625\u5206", + "\u6e05\u660e", "\u8c37\u96e8", "\u7acb\u590f", "\u5c0f\u6ee1", "\u8292\u79cd", "\u590f\u81f3", + "\u5c0f\u6691", + "\u5927\u6691", "\u7acb\u79cb", "\u5904\u6691", "\u767d\u9732", "\u79cb\u5206", "\u5bd2\u9732", + "\u971c\u964d", + "\u7acb\u51ac", "\u5c0f\u96ea", "\u5927\u96ea", "\u51ac\u81f3" + ], + /** + * 1900-2100各年的24节气日期速查表 + * @Array Of Property + * @return 0x string For splice + */ + sTermInfo: ['9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', + '97bcf97c3598082c95f8c965cc920f', + '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', + '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', 'b027097bd097c36b0b6fc9274c91aa', + '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd0b06bdb0722c965ce1cfcc920f', + 'b027097bd097c36b0b6fc9274c91aa', '9778397bd19801ec9210c965cc920e', '97b6b97bd19801ec95f8c965cc920f', + '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd197c36c9210c9274c91aa', + '97b6b97bd19801ec95f8c965cc920e', '97bd09801d98082c95f8e1cfcc920f', '97bd097bd097c36b0b6fc9210c8dc2', + '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec95f8c965cc920e', '97bcf97c3598082c95f8e1cfcc920f', + '97bd097bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', + '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', + '97b6b97bd19801ec9210c965cc920e', '97bcf97c3598082c95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', + '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', + '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', + '97bcf97c359801ec95f8c965cc920f', '97bd097bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', + '97b6b97bd19801ec9210c965cc920e', '97bcf97c359801ec95f8c965cc920f', '97bd097bd07f595b0b6fc920fb0722', + '9778397bd097c36b0b6fc9210c8dc2', '9778397bd19801ec9210c9274c920e', '97b6b97bd19801ec95f8c965cc920f', + '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', + '97b6b97bd19801ec95f8c965cc920f', '97bd07f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', + '9778397bd097c36c9210c9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bd07f1487f595b0b0bc920fb0722', + '7f0e397bd097c36b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', + '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', + '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', + '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', '97bcf7f1487f531b0b0bb0b6fb0722', + '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b97bd19801ec9210c965cc920e', + '97bcf7f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', + '97b6b97bd19801ec9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', + '9778397bd097c36b0b6fc9210c91aa', '97b6b97bd197c36c9210c9274c920e', '97bcf7f0e47f531b0b0bb0b6fb0722', + '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '9778397bd097c36c9210c9274c920e', + '97b6b7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c36b0b6fc9210c8dc2', + '9778397bd097c36b0b70c9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', + '7f0e397bd097c35b0b6fc9210c8dc2', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', + '7f0e27f1487f595b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', + '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', + '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', + '7f0e397bd097c35b0b6fc920fb0722', '9778397bd097c36b0b6fc9274c91aa', '97b6b7f0e47f531b0723b0b6fb0721', + '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9274c91aa', + '97b6b7f0e47f531b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', + '9778397bd097c36b0b6fc9210c91aa', '97b6b7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', + '7f0e397bd07f595b0b0bc920fb0722', '9778397bd097c36b0b6fc9210c8dc2', '977837f0e37f149b0723b0787b0721', + '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f5307f595b0b0bc920fb0722', '7f0e397bd097c35b0b6fc9210c8dc2', + '977837f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e37f1487f595b0b0bb0b6fb0722', + '7f0e397bd097c35b0b6fc9210c8dc2', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', + '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', '977837f0e37f14998082b0787b06bd', + '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd097c35b0b6fc920fb0722', + '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', + '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', + '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14998082b0787b06bd', + '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0b0bb0b6fb0722', '7f0e397bd07f595b0b0bc920fb0722', + '977837f0e37f14998082b0723b06bd', '7f07e7f0e37f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', + '7f0e397bd07f595b0b0bc920fb0722', '977837f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b0721', + '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f595b0b0bb0b6fb0722', '7f0e37f0e37f14898082b0723b02d5', + '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e37f1487f531b0b0bb0b6fb0722', + '7f0e37f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', + '7f0e37f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', + '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e37f14898082b072297c35', + '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722', + '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f149b0723b0787b0721', + '7f0e27f1487f531b0b0bb0b6fb0722', '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14998082b0723b06bd', + '7f07e7f0e47f149b0723b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', '7f0e37f0e366aa89801eb072297c35', + '7ec967f0e37f14998082b0723b06bd', '7f07e7f0e37f14998083b0787b0721', '7f0e27f0e47f531b0723b0b6fb0722', + '7f0e37f0e366aa89801eb072297c35', '7ec967f0e37f14898082b0723b02d5', '7f07e7f0e37f14998082b0787b0721', + '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66aa89801e9808297c35', '665f67f0e37f14898082b0723b02d5', + '7ec967f0e37f14998082b0787b0721', '7f07e7f0e47f531b0723b0b6fb0722', '7f0e36665b66a449801e9808297c35', + '665f67f0e37f14898082b0723b02d5', '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', + '7f0e36665b66a449801e9808297c35', '665f67f0e37f14898082b072297c35', '7ec967f0e37f14998082b0787b06bd', + '7f07e7f0e47f531b0723b0b6fb0721', '7f0e26665b66a449801e9808297c35', '665f67f0e37f1489801eb072297c35', + '7ec967f0e37f14998082b0787b06bd', '7f07e7f0e47f531b0723b0b6fb0721', '7f0e27f1487f531b0b0bb0b6fb0722' + ], + /** + * 数字转中文速查表 + * @Array Of Property + * @trans ['日','一','二','三','四','五','六','七','八','九','十'] + * @return Cn string + */ + nStr1: ["\u65e5", "\u4e00", "\u4e8c", "\u4e09", "\u56db", "\u4e94", "\u516d", "\u4e03", "\u516b", "\u4e5d", + "\u5341" + ], + /** + * 日期转农历称呼速查表 + * @Array Of Property + * @trans ['初','十','廿','卅'] + * @return Cn string + */ + nStr2: ["\u521d", "\u5341", "\u5eff", "\u5345"], + /** + * 月份转农历称呼速查表 + * @Array Of Property + * @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊'] + * @return Cn string + */ + nStr3: ["\u6b63", "\u4e8c", "\u4e09", "\u56db", "\u4e94", "\u516d", "\u4e03", "\u516b", "\u4e5d", "\u5341", + "\u51ac", + "\u814a" + ], + /** + * 返回农历y年一整年的总天数 + * @param lunar Year + * @return Number + * @eg:let count = calendar.lYearDays(1987) ;//count=387 + */ + lYearDays: function(y) { + let i, sum = 348; + for (i = 0x8000; i > 0x8; i >>= 1) { + sum += (calendar.lunarInfo[y - 1900] & i) ? 1 : 0; + } + return (sum + calendar.leapDays(y)); + }, + /** + * 返回农历y年闰月是哪个月;若y年没有闰月 则返回0 + * @param lunar Year + * @return Number (0-12) + * @eg:let leapMonth = calendar.leapMonth(1987) ;//leapMonth=6 + */ + leapMonth: function(y) { //闰字编码 \u95f0 + return (calendar.lunarInfo[y - 1900] & 0xf); + }, + /** + * 返回农历y年闰月的天数 若该年没有闰月则返回0 + * @param lunar Year + * @return Number (0、29、30) + * @eg:let leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29 + */ + leapDays: function(y) { + if (calendar.leapMonth(y)) { + return ((calendar.lunarInfo[y - 1900] & 0x10000) ? 30 : 29); + } + return (0); + }, + /** + * 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法 + * @param lunar Year + * @return Number (-1、29、30) + * @eg:let MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29 + */ + monthDays: function(y, m) { + if (m > 12 || m < 1) { + return -1 + } //月份参数从1至12,参数错误返回-1 + return ((calendar.lunarInfo[y - 1900] & (0x10000 >> m)) ? 30 : 29); + }, + /** + * 返回公历(!)y年m月的天数 + * @param solar Year + * @return Number (-1、28、29、30、31) + * @eg:let solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30 + */ + solarDays: function(y, m) { + if (m > 12 || m < 1) { + return -1 + } //若参数错误 返回-1 + let ms = m - 1; + if (ms == 1) { //2月份的闰平规律测算后确认返回28或29 + return (((y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0)) ? 29 : 28); + } else { + return (calendar.solarMonth[ms]); + } + }, + /** + * 农历年份转换为干支纪年 + * @param lYear 农历年的年份数 + * @return Cn string + */ + toGanZhiYear: function(lYear) { + let ganKey = (lYear - 3) % 10; + let zhiKey = (lYear - 3) % 12; + if (ganKey == 0) ganKey = 10; //如果余数为0则为最后一个天干 + if (zhiKey == 0) zhiKey = 12; //如果余数为0则为最后一个地支 + return calendar.Gan[ganKey - 1] + calendar.Zhi[zhiKey - 1]; + }, + /** + * 公历月、日判断所属星座 + * @param cMonth [description] + * @param cDay [description] + * @return Cn string + */ + toAstro: function(cMonth, cDay) { + let s = + "\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf"; + let arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22]; + return s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + "\u5ea7"; //座 + }, + /** + * 传入offset偏移量返回干支 + * @param offset 相对甲子的偏移量 + * @return Cn string + */ + toGanZhi: function(offset) { + return calendar.Gan[offset % 10] + calendar.Zhi[offset % 12]; + }, + /** + * 传入公历(!)y年获得该年第n个节气的公历日期 + * @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起 + * @return day Number + * @eg:let _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春 + */ + getTerm: function(y, n) { + if (y < 1900 || y > 2100) { + return -1; + } + if (n < 1 || n > 24) { + return -1; + } + let _table = calendar.sTermInfo[y - 1900]; + let _info = [ + parseInt('0x' + _table.substr(0, 5)).toString(), + parseInt('0x' + _table.substr(5, 5)).toString(), + parseInt('0x' + _table.substr(10, 5)).toString(), + parseInt('0x' + _table.substr(15, 5)).toString(), + parseInt('0x' + _table.substr(20, 5)).toString(), + parseInt('0x' + _table.substr(25, 5)).toString() + ]; + let _calday = [ + _info[0].substr(0, 1), + _info[0].substr(1, 2), + _info[0].substr(3, 1), + _info[0].substr(4, 2), + _info[1].substr(0, 1), + _info[1].substr(1, 2), + _info[1].substr(3, 1), + _info[1].substr(4, 2), + _info[2].substr(0, 1), + _info[2].substr(1, 2), + _info[2].substr(3, 1), + _info[2].substr(4, 2), + _info[3].substr(0, 1), + _info[3].substr(1, 2), + _info[3].substr(3, 1), + _info[3].substr(4, 2), + _info[4].substr(0, 1), + _info[4].substr(1, 2), + _info[4].substr(3, 1), + _info[4].substr(4, 2), + _info[5].substr(0, 1), + _info[5].substr(1, 2), + _info[5].substr(3, 1), + _info[5].substr(4, 2), + ]; + return parseInt(_calday[n - 1]); + }, + /** + * 传入农历数字月份返回汉语通俗表示法 + * @param lunar month + * @return Cn string + * @eg:let cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月' + */ + toChinaMonth: function(m) { // 月 => \u6708 + if (m > 12 || m < 1) { + return -1 + } //若参数错误 返回-1 + let s = calendar.nStr3[m - 1]; + s += "\u6708"; //加上月字 + return s; + }, + /** + * 传入农历日期数字返回汉字表示法 + * @param lunar day + * @return Cn string + * @eg:let cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一' + */ + toChinaDay: function(d) { //日 => \u65e5 + let s; + switch (d) { + case 10: + s = '\u521d\u5341'; + break; + case 20: + s = '\u4e8c\u5341'; + break; + break; + case 30: + s = '\u4e09\u5341'; + break; + break; + default: + s = calendar.nStr2[Math.floor(d / 10)]; + s += calendar.nStr1[d % 10]; + } + return (s); + }, + /** + * 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春” + * @param y year + * @return Cn string + * @eg:let animal = calendar.getAnimal(1987) ;//animal='兔' + */ + getAnimal: function(y) { + return calendar.Animals[(y - 4) % 12] + }, + /** + * 传入阳历年月日获得详细的公历、农历object信息 <=>JSON + * @param y solar year + * @param m solar month + * @param d solar day + * @return JSON object + * @eg:console.log(calendar.solar2lunar(1987,11,01)); + */ + solar2lunar: function(y, m, d) { //参数区间1900.1.31~2100.12.31 + if (y < 1900 || y > 2100) { + return -1; + } //年份限定、上限 + if (y == 1900 && m == 1 && d < 31) { + return -1; + } //下限 + let objDate; + if (!y) { //未传参 获得当天 + objDate = new Date(); + } else { + objDate = new Date(y, parseInt(m) - 1, d) + } + let i, leap = 0, + temp = 0; + //修正ymd参数 + y = objDate.getFullYear(); + m = objDate.getMonth() + 1; + d = objDate.getDate(); + let offset = (Date.UTC(objDate.getFullYear(), objDate.getMonth(), objDate.getDate()) - Date.UTC(1900, 0, + 31)) / + 86400000; + for (i = 1900; i < 2101 && offset > 0; i++) { + temp = calendar.lYearDays(i); + offset -= temp; + } + if (offset < 0) { + offset += temp; + i--; + } + //是否今天 + let isTodayObj = new Date(), + isToday = false; + if (isTodayObj.getFullYear() == y && isTodayObj.getMonth() + 1 == m && isTodayObj.getDate() == d) { + isToday = true; + } + //星期几 + let nWeek = objDate.getDay(), + cWeek = calendar.nStr1[nWeek]; + if (nWeek == 0) { + nWeek = 7; + } //数字表示周几顺应天朝周一开始的惯例 + //农历年 + let year = i; + leap = calendar.leapMonth(i); //闰哪个月 + let isLeap = false; + //效验闰月 + for (i = 1; i < 13 && offset > 0; i++) { + //闰月 + if (leap > 0 && i == (leap + 1) && isLeap == false) { + --i; + isLeap = true; + temp = calendar.leapDays(year); //计算农历闰月天数 + } else { + temp = calendar.monthDays(year, i); //计算农历普通月天数 + } + //解除闰月 + if (isLeap == true && i == (leap + 1)) { + isLeap = false; + } + offset -= temp; + } + if (offset == 0 && leap > 0 && i == leap + 1) + if (isLeap) { + isLeap = false; + } else { + isLeap = true; + --i; + } + if (offset < 0) { + offset += temp; + --i; + } + //农历月 + let month = i; + //农历日 + let day = offset + 1; + //天干地支处理 + let sm = m - 1; + let gzY = calendar.toGanZhiYear(year); + //月柱 1900年1月小寒以前为 丙子月(60进制12) + let firstNode = calendar.getTerm(year, (m * 2 - 1)); //返回当月「节」为几日开始 + let secondNode = calendar.getTerm(year, (m * 2)); //返回当月「节」为几日开始 + //依据12节气修正干支月 + let gzM = calendar.toGanZhi((y - 1900) * 12 + m + 11); + if (d >= firstNode) { + gzM = calendar.toGanZhi((y - 1900) * 12 + m + 12); + } + //传入的日期的节气与否 + let isTerm = false; + let Term = null; + if (firstNode == d) { + isTerm = true; + Term = calendar.solarTerm[m * 2 - 2]; + } + if (secondNode == d) { + isTerm = true; + Term = calendar.solarTerm[m * 2 - 1]; + } + //日柱 当月一日与 1900/1/1 相差天数 + let dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 86400000 + 25567 + 10; + let gzD = calendar.toGanZhi(dayCyclical + d - 1); + //该日期所属的星座 + let astro = calendar.toAstro(m, d); + return { + 'lYear': year, + 'lMonth': month, + 'lDay': day, + 'Animal': calendar.getAnimal(year), + 'IMonthCn': (isLeap ? "\u95f0" : '') + calendar.toChinaMonth(month), + 'IDayCn': calendar.toChinaDay(day), + 'cYear': y, + 'cMonth': m, + 'cDay': d, + 'gzYear': gzY, + 'gzMonth': gzM, + 'gzDay': gzD, + 'isToday': isToday, + 'isLeap': isLeap, + 'nWeek': nWeek, + 'ncWeek': "\u661f\u671f" + cWeek, + 'isTerm': isTerm, + 'Term': Term, + 'astro': astro + }; + }, + /** + * 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON + * @param y lunar year + * @param m lunar month + * @param d lunar day + * @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可] + * @return JSON object + * @eg:console.log(calendar.lunar2solar(1987,9,10)); + */ + lunar2solar: function(y, m, d, isLeapMonth) { //参数区间1900.1.31~2100.12.1 + isLeapMonth = !!isLeapMonth; + let leapOffset = 0; + let leapMonth = calendar.leapMonth(y); + let leapDay = calendar.leapDays(y); + if (isLeapMonth && (leapMonth != m)) { + return -1; + } //传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同 + if (y == 2100 && m == 12 && d > 1 || y == 1900 && m == 1 && d < 31) { + return -1; + } //超出了最大极限值 + let day = calendar.monthDays(y, m); + let _day = day; + //bugFix 2016-9-25 + //if month is leap, _day use leapDays method + if (isLeapMonth) { + _day = calendar.leapDays(y, m); + } + if (y < 1900 || y > 2100 || d > _day) { + return -1; + } //参数合法性效验 + //计算农历的时间差 + let offset = 0; + for (let i = 1900; i < y; i++) { + offset += calendar.lYearDays(i); + } + let leap = 0, + isAdd = false; + for (let i = 1; i < m; i++) { + leap = calendar.leapMonth(y); + if (!isAdd) { //处理闰月 + if (leap <= i && leap > 0) { + offset += calendar.leapDays(y); + isAdd = true; + } + } + offset += calendar.monthDays(y, i); + } + //转换闰月农历 需补充该年闰月的前一个月的时差 + if (isLeapMonth) { + offset += day; + } + //1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点) + let stmap = Date.UTC(1900, 1, 30, 0, 0, 0); + let calObj = new Date((offset + d - 31) * 86400000 + stmap); + let cY = calObj.getUTCFullYear(); + let cM = calObj.getUTCMonth() + 1; + let cD = calObj.getUTCDate(); + return calendar.solar2lunar(cY, cM, cD); + } +}; + +const lang = { + m_cn: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'], + m_en: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], + h_cn: ['日', '一', '二', '三', '四', '五', '六'], + h_en: ['S', 'M', 'T', 'W', 'T', 'F', 'S'] +} + +export default { + solarTolunar: calendar.solar2lunar, + lunarTosolar: calendar.lunar2solar, + lang: lang +}; \ No newline at end of file diff --git a/components/firstui/fui-card/fui-card.vue b/components/firstui/fui-card/fui-card.vue new file mode 100644 index 0000000..81f7e94 --- /dev/null +++ b/components/firstui/fui-card/fui-card.vue @@ -0,0 +1,326 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-cascader/fui-cascader.vue b/components/firstui/fui-cascader/fui-cascader.vue new file mode 100644 index 0000000..42ae403 --- /dev/null +++ b/components/firstui/fui-cascader/fui-cascader.vue @@ -0,0 +1,588 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-checkbox-group/fui-checkbox-group.vue b/components/firstui/fui-checkbox-group/fui-checkbox-group.vue new file mode 100644 index 0000000..7edce51 --- /dev/null +++ b/components/firstui/fui-checkbox-group/fui-checkbox-group.vue @@ -0,0 +1,102 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-checkbox/fui-checkbox.vue b/components/firstui/fui-checkbox/fui-checkbox.vue new file mode 100644 index 0000000..33b7ced --- /dev/null +++ b/components/firstui/fui-checkbox/fui-checkbox.vue @@ -0,0 +1,241 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-circle/fui-circle.vue b/components/firstui/fui-circle/fui-circle.vue new file mode 100644 index 0000000..9e2d030 --- /dev/null +++ b/components/firstui/fui-circle/fui-circle.vue @@ -0,0 +1,339 @@ + + + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/bridge/bridge-weex.js b/components/firstui/fui-circle/gcanvas/bridge/bridge-weex.js new file mode 100644 index 0000000..9ab6ed7 --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/bridge/bridge-weex.js @@ -0,0 +1,242 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 86 1 4 072 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +const isWeex = typeof WXEnvironment !== 'undefined'; +const isWeexIOS = isWeex && /ios/i.test(WXEnvironment.platform); +const isWeexAndroid = isWeex && !isWeexIOS; + +import GLmethod from '../context-webgl/GLmethod'; + +const GCanvasModule = + (typeof weex !== 'undefined' && weex.requireModule) ? (weex.requireModule('gcanvas')) : + (typeof __weex_require__ !== 'undefined') ? (__weex_require__('@weex-module/gcanvas')) : {}; + +let isDebugging = false; + +let isComboDisabled = false; + +const logCommand = (function () { + const methodQuery = []; + Object.keys(GLmethod).forEach(key => { + methodQuery[GLmethod[key]] = key; + }) + const queryMethod = (id) => { + return methodQuery[parseInt(id)] || 'NotFoundMethod'; + } + const logCommand = (id, cmds) => { + const mId = cmds.split(',')[0]; + const mName = queryMethod(mId); + console.log(`=== callNative - componentId:${id}; method: ${mName}; cmds: ${cmds}`); + } + return logCommand; +})(); + +function joinArray(arr, sep) { + let res = ''; + for (let i = 0; i < arr.length; i++) { + if (i !== 0) { + res += sep; + } + res += arr[i]; + } + return res; +} + +const commandsCache = {} + +const GBridge = { + + callEnable: (ref, configArray) => { + + commandsCache[ref] = []; + + return GCanvasModule.enable({ + componentId: ref, + config: configArray + }); + }, + + callEnableDebug: () => { + isDebugging = true; + }, + + callEnableDisableCombo: () => { + isComboDisabled = true; + }, + + callSetContextType: function (componentId, context_type) { + GCanvasModule.setContextType(context_type, componentId); + }, + + callReset: function(id){ + GCanvasModule.resetComponent && canvasModule.resetComponent(componentId); + }, + + render: isWeexIOS ? function (componentId) { + return GCanvasModule.extendCallNative({ + contextId: componentId, + type: 0x60000001 + }); + } : function (componentId) { + return callGCanvasLinkNative(componentId, 0x60000001, 'render'); + }, + + render2d: isWeexIOS ? function (componentId, commands, callback) { + + if (isDebugging) { + console.log('>>> >>> render2d ==='); + console.log('>>> commands: ' + commands); + } + + GCanvasModule.render([commands, callback?true:false], componentId, callback); + + } : function (componentId, commands,callback) { + + if (isDebugging) { + console.log('>>> >>> render2d ==='); + console.log('>>> commands: ' + commands); + } + + callGCanvasLinkNative(componentId, 0x20000001, commands); + if(callback){ + callback(); + } + }, + + callExtendCallNative: isWeexIOS ? function (componentId, cmdArgs) { + + throw 'should not be here anymore ' + cmdArgs; + + } : function (componentId, cmdArgs) { + + throw 'should not be here anymore ' + cmdArgs; + + }, + + + flushNative: isWeexIOS ? function (componentId) { + + const cmdArgs = joinArray(commandsCache[componentId], ';'); + commandsCache[componentId] = []; + + if (isDebugging) { + console.log('>>> >>> flush native ==='); + console.log('>>> commands: ' + cmdArgs); + } + + const result = GCanvasModule.extendCallNative({ + "contextId": componentId, + "type": 0x60000000, + "args": cmdArgs + }); + + const res = result && result.result; + + if (isDebugging) { + console.log('>>> result: ' + res); + } + + return res; + + } : function (componentId) { + + const cmdArgs = joinArray(commandsCache[componentId], ';'); + commandsCache[componentId] = []; + + if (isDebugging) { + console.log('>>> >>> flush native ==='); + console.log('>>> commands: ' + cmdArgs); + } + + const result = callGCanvasLinkNative(componentId, 0x60000000, cmdArgs); + + if (isDebugging) { + console.log('>>> result: ' + result); + } + + return result; + }, + + callNative: function (componentId, cmdArgs, cache) { + + if (isDebugging) { + logCommand(componentId, cmdArgs); + } + + commandsCache[componentId].push(cmdArgs); + + if (!cache || isComboDisabled) { + return GBridge.flushNative(componentId); + } else { + return undefined; + } + }, + + texImage2D(componentId, ...args) { + if (isWeexIOS) { + if (args.length === 6) { + const [target, level, internalformat, format, type, image] = args; + GBridge.callNative( + componentId, + GLmethod.texImage2D + ',' + 6 + ',' + target + ',' + level + ',' + internalformat + ',' + format + ',' + type + ',' + image.src + ) + } else if (args.length === 9) { + const [target, level, internalformat, width, height, border, format, type, image] = args; + GBridge.callNative( + componentId, + GLmethod.texImage2D + ',' + 9 + ',' + target + ',' + level + ',' + internalformat + ',' + width + ',' + height + ',' + border + ',' + + + format + ',' + type + ',' + (image ? image.src : 0) + ) + } + } else if (isWeexAndroid) { + if (args.length === 6) { + const [target, level, internalformat, format, type, image] = args; + GCanvasModule.texImage2D(componentId, target, level, internalformat, format, type, image.src); + } else if (args.length === 9) { + const [target, level, internalformat, width, height, border, format, type, image] = args; + GCanvasModule.texImage2D(componentId, target, level, internalformat, width, height, border, format, type, (image ? image.src : 0)); + } + } + }, + + texSubImage2D(componentId, target, level, xoffset, yoffset, format, type, image) { + if (isWeexIOS) { + if (arguments.length === 8) { + GBridge.callNative( + componentId, + GLmethod.texSubImage2D + ',' + 6 + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset, + ',' + format + ',' + type + ',' + image.src + ) + } + } else if (isWeexAndroid) { + GCanvasModule.texSubImage2D(componentId, target, level, xoffset, yoffset, format, type, image.src); + } + }, + + bindImageTexture(componentId, src, imageId) { + GCanvasModule.bindImageTexture([src, imageId], componentId); + }, + + perloadImage([url, id], callback) { + GCanvasModule.preLoadImage([url, id], function (image) { + image.url = url; + image.id = id; + callback(image); + }); + }, + + measureText(text, fontStyle, componentId) { + return GCanvasModule.measureText([text, fontStyle], componentId); + }, + + getImageData (componentId, x, y, w, h, callback) { + GCanvasModule.getImageData([x, y,w,h],componentId,callback); + }, + + putImageData (componentId, data, x, y, w, h, callback) { + GCanvasModule.putImageData([x, y,w,h,data],componentId,callback); + }, + + toTempFilePath(componentId, x, y, width, height, destWidth, destHeight, fileType, quality, callback){ + GCanvasModule.toTempFilePath([x, y, width,height, destWidth, destHeight, fileType, quality], componentId, callback); + } +} + +export default GBridge; \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/context-2d/FillStyleLinearGradient.js b/components/firstui/fui-circle/gcanvas/context-2d/FillStyleLinearGradient.js new file mode 100644 index 0000000..20d56cb --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/context-2d/FillStyleLinearGradient.js @@ -0,0 +1,19 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8 6140 72 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +class FillStyleLinearGradient { + + constructor(x0, y0, x1, y1) { + this._start_pos = { _x: x0, _y: y0 }; + this._end_pos = { _x: x1, _y: y1 }; + this._stop_count = 0; + this._stops = [0, 0, 0, 0, 0]; + } + + addColorStop = function (pos, color) { + if (this._stop_count < 5 && 0.0 <= pos && pos <= 1.0) { + this._stops[this._stop_count] = { _pos: pos, _color: color }; + this._stop_count++; + } + } +} + +export default FillStyleLinearGradient; \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/context-2d/FillStylePattern.js b/components/firstui/fui-circle/gcanvas/context-2d/FillStylePattern.js new file mode 100644 index 0000000..a411344 --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/context-2d/FillStylePattern.js @@ -0,0 +1,9 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 61 4 0725 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +class FillStylePattern { + constructor(img, pattern) { + this._style = pattern; + this._img = img; + } +} + +export default FillStylePattern; \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/context-2d/FillStyleRadialGradient.js b/components/firstui/fui-circle/gcanvas/context-2d/FillStyleRadialGradient.js new file mode 100644 index 0000000..b9a968e --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/context-2d/FillStyleRadialGradient.js @@ -0,0 +1,18 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 61407 25 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +class FillStyleRadialGradient { + constructor(x0, y0, r0, x1, y1, r1) { + this._start_pos = { _x: x0, _y: y0, _r: r0 }; + this._end_pos = { _x: x1, _y: y1, _r: r1 }; + this._stop_count = 0; + this._stops = [0, 0, 0, 0, 0]; + } + + addColorStop(pos, color) { + if (this._stop_count < 5 && 0.0 <= pos && pos <= 1.0) { + this._stops[this._stop_count] = { _pos: pos, _color: color }; + this._stop_count++; + } + } +} + +export default FillStyleRadialGradient; \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/context-2d/RenderingContext.js b/components/firstui/fui-circle/gcanvas/context-2d/RenderingContext.js new file mode 100644 index 0000000..902c58b --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/context-2d/RenderingContext.js @@ -0,0 +1,667 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 6 14 0 7 25 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import FillStylePattern from './FillStylePattern'; +import FillStyleLinearGradient from './FillStyleLinearGradient'; +import FillStyleRadialGradient from './FillStyleRadialGradient'; +import GImage from '../env/image.js'; +import { + ArrayBufferToBase64, + Base64ToUint8ClampedArray +} from '../env/tool.js'; + +export default class CanvasRenderingContext2D { + + _drawCommands = ''; + + _globalAlpha = 1.0; + + _fillStyle = 'rgb(0,0,0)'; + _strokeStyle = 'rgb(0,0,0)'; + + _lineWidth = 1; + _lineCap = 'butt'; + _lineJoin = 'miter'; + + _miterLimit = 10; + + _globalCompositeOperation = 'source-over'; + + _textAlign = 'start'; + _textBaseline = 'alphabetic'; + + _font = '10px sans-serif'; + + _savedGlobalAlpha = []; + + timer = null; + componentId = null; + + _notCommitDrawImageCache = []; + _needRedrawImageCache = []; + _redrawCommands = ''; + _autoSaveContext = true; + // _imageMap = new GHashMap(); + // _textureMap = new GHashMap(); + + constructor() { + this.className = 'CanvasRenderingContext2D'; + //this.save() + } + + setFillStyle(value) { + this.fillStyle = value; + } + + set fillStyle(value) { + this._fillStyle = value; + + if (typeof(value) == 'string') { + this._drawCommands = this._drawCommands.concat("F" + value + ";"); + } else if (value instanceof FillStylePattern) { + const image = value._img; + if (!image.complete) { + image.onload = () => { + var index = this._needRedrawImageCache.indexOf(image); + if (index > -1) { + this._needRedrawImageCache.splice(index, 1); + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + this._redrawflush(true); + } + } + this._notCommitDrawImageCache.push(image); + } else { + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + } + + //CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + this._drawCommands = this._drawCommands.concat("G" + image._id + "," + value._style + ";"); + } else if (value instanceof FillStyleLinearGradient) { + var command = "D" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + + value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," + + value._stop_count; + for (var i = 0; i < value._stop_count; ++i) { + command += ("," + value._stops[i]._pos + "," + value._stops[i]._color); + } + this._drawCommands = this._drawCommands.concat(command + ";"); + } else if (value instanceof FillStyleRadialGradient) { + var command = "H" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + value._start_pos._r + .toFixed(2) + "," + + value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," + value._end_pos._r.toFixed(2) + "," + + value._stop_count; + for (var i = 0; i < value._stop_count; ++i) { + command += ("," + value._stops[i]._pos + "," + value._stops[i]._color); + } + this._drawCommands = this._drawCommands.concat(command + ";"); + } + } + + get fillStyle() { + return this._fillStyle; + } + + get globalAlpha() { + return this._globalAlpha; + } + + setGlobalAlpha(value) { + this.globalAlpha = value; + } + + set globalAlpha(value) { + this._globalAlpha = value; + this._drawCommands = this._drawCommands.concat("a" + value.toFixed(2) + ";"); + } + + + get strokeStyle() { + return this._strokeStyle; + } + + setStrokeStyle(value) { + this.strokeStyle = value; + } + + set strokeStyle(value) { + + this._strokeStyle = value; + + if (typeof(value) == 'string') { + this._drawCommands = this._drawCommands.concat("S" + value + ";"); + } else if (value instanceof FillStylePattern) { + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + this._drawCommands = this._drawCommands.concat("G" + image._id + "," + value._style + ";"); + } else if (value instanceof FillStyleLinearGradient) { + var command = "D" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + + value._end_pos._x.toFixed(2) + "," + value._end_pos._y.toFixed(2) + "," + + value._stop_count; + + for (var i = 0; i < value._stop_count; ++i) { + command += ("," + value._stops[i]._pos + "," + value._stops[i]._color); + } + this._drawCommands = this._drawCommands.concat(command + ";"); + } else if (value instanceof FillStyleRadialGradient) { + var command = "H" + value._start_pos._x.toFixed(2) + "," + value._start_pos._y.toFixed(2) + "," + value._start_pos._r + .toFixed(2) + "," + + value._end_pos._x.toFixed(2) + "," + value._end_pos._y + ",".toFixed(2) + value._end_pos._r.toFixed(2) + "," + + value._stop_count; + + for (var i = 0; i < value._stop_count; ++i) { + command += ("," + value._stops[i]._pos + "," + value._stops[i]._color); + } + this._drawCommands = this._drawCommands.concat(command + ";"); + } + } + + get lineWidth() { + return this._lineWidth; + } + + setLineWidth(value) { + this.lineWidth = value; + } + + set lineWidth(value) { + this._lineWidth = value; + this._drawCommands = this._drawCommands.concat("W" + value + ";"); + } + + get lineCap() { + return this._lineCap; + } + + setLineCap(value) { + this.lineCap = value; + } + + set lineCap(value) { + this._lineCap = value; + this._drawCommands = this._drawCommands.concat("C" + value + ";"); + } + + get lineJoin() { + return this._lineJoin; + } + + setLineJoin(value) { + this.lineJoin = value + } + + set lineJoin(value) { + this._lineJoin = value; + this._drawCommands = this._drawCommands.concat("J" + value + ";"); + } + + get miterLimit() { + return this._miterLimit; + } + + setMiterLimit(value) { + this.miterLimit = value + } + + set miterLimit(value) { + this._miterLimit = value; + this._drawCommands = this._drawCommands.concat("M" + value + ";"); + } + + get globalCompositeOperation() { + return this._globalCompositeOperation; + } + + set globalCompositeOperation(value) { + + this._globalCompositeOperation = value; + let mode = 0; + switch (value) { + case "source-over": + mode = 0; + break; + case "source-atop": + mode = 5; + break; + case "source-in": + mode = 0; + break; + case "source-out": + mode = 2; + break; + case "destination-over": + mode = 4; + break; + case "destination-atop": + mode = 4; + break; + case "destination-in": + mode = 4; + break; + case "destination-out": + mode = 3; + break; + case "lighter": + mode = 1; + break; + case "copy": + mode = 2; + break; + case "xor": + mode = 6; + break; + default: + mode = 0; + } + + this._drawCommands = this._drawCommands.concat("B" + mode + ";"); + } + + get textAlign() { + return this._textAlign; + } + + setTextAlign(value) { + this.textAlign = value + } + + set textAlign(value) { + + this._textAlign = value; + let Align = 0; + switch (value) { + case "start": + Align = 0; + break; + case "end": + Align = 1; + break; + case "left": + Align = 2; + break; + case "center": + Align = 3; + break; + case "right": + Align = 4; + break; + default: + Align = 0; + } + + this._drawCommands = this._drawCommands.concat("A" + Align + ";"); + } + + get textBaseline() { + return this._textBaseline; + } + + setTextBaseline(value) { + this.textBaseline = value + } + + set textBaseline(value) { + this._textBaseline = value; + let baseline = 0; + switch (value) { + case "alphabetic": + baseline = 0; + break; + case "middle": + baseline = 1; + break; + case "top": + baseline = 2; + break; + case "hanging": + baseline = 3; + break; + case "bottom": + baseline = 4; + break; + case "ideographic": + baseline = 5; + break; + default: + baseline = 0; + break; + } + + this._drawCommands = this._drawCommands.concat("E" + baseline + ";"); + } + + get font() { + return this._font; + } + + setFontSize(size) { + var str = this._font; + var strs = str.trim().split(/\s+/); + for (var i = 0; i < strs.length; i++) { + var values = ["normal", "italic", "oblique", "normal", "small-caps", "normal", "bold", + "bolder", "lighter", "100", "200", "300", "400", "500", "600", "700", "800", "900", + "normal", "ultra-condensed", "extra-condensed", "condensed", "semi-condensed", + "semi-expanded", "expanded", "extra-expanded", "ultra-expanded" + ]; + + if (-1 == values.indexOf(strs[i].trim())) { + if (typeof size === 'string') { + strs[i] = size; + } else if (typeof size === 'number') { + strs[i] = String(size) + 'px'; + } + break; + } + } + this.font = strs.join(" "); + } + + set font(value) { + this._font = value; + this._drawCommands = this._drawCommands.concat("j" + value + ";"); + } + + setTransform(a, b, c, d, tx, ty) { + this._drawCommands = this._drawCommands.concat("t" + + (a === 1 ? "1" : a.toFixed(2)) + "," + + (b === 0 ? "0" : b.toFixed(2)) + "," + + (c === 0 ? "0" : c.toFixed(2)) + "," + + (d === 1 ? "1" : d.toFixed(2)) + "," + tx.toFixed(2) + "," + ty.toFixed(2) + ";"); + } + + transform(a, b, c, d, tx, ty) { + this._drawCommands = this._drawCommands.concat("f" + + (a === 1 ? "1" : a.toFixed(2)) + "," + + (b === 0 ? "0" : b.toFixed(2)) + "," + + (c === 0 ? "0" : c.toFixed(2)) + "," + + (d === 1 ? "1" : d.toFixed(2)) + "," + tx + "," + ty + ";"); + } + + resetTransform() { + this._drawCommands = this._drawCommands.concat("m;"); + } + + scale(a, d) { + this._drawCommands = this._drawCommands.concat("k" + a.toFixed(2) + "," + + d.toFixed(2) + ";"); + } + + rotate(angle) { + this._drawCommands = this._drawCommands + .concat("r" + angle.toFixed(6) + ";"); + } + + translate(tx, ty) { + this._drawCommands = this._drawCommands.concat("l" + tx.toFixed(2) + "," + ty.toFixed(2) + ";"); + } + + save() { + this._savedGlobalAlpha.push(this._globalAlpha); + this._drawCommands = this._drawCommands.concat("v;"); + } + + restore() { + this._drawCommands = this._drawCommands.concat("e;"); + this._globalAlpha = this._savedGlobalAlpha.pop(); + } + + createPattern(img, pattern) { + if (typeof img === 'string') { + var imgObj = new GImage(); + imgObj.src = img; + img = imgObj; + } + return new FillStylePattern(img, pattern); + } + + createLinearGradient(x0, y0, x1, y1) { + return new FillStyleLinearGradient(x0, y0, x1, y1); + } + + createRadialGradient = function(x0, y0, r0, x1, y1, r1) { + return new FillStyleRadialGradient(x0, y0, r0, x1, y1, r1); + }; + + createCircularGradient = function(x0, y0, r0) { + return new FillStyleRadialGradient(x0, y0, 0, x0, y0, r0); + }; + + strokeRect(x, y, w, h) { + this._drawCommands = this._drawCommands.concat("s" + x + "," + y + "," + w + "," + h + ";"); + } + + + clearRect(x, y, w, h) { + this._drawCommands = this._drawCommands.concat("c" + x + "," + y + "," + w + + "," + h + ";"); + } + + clip() { + this._drawCommands = this._drawCommands.concat("p;"); + } + + resetClip() { + this._drawCommands = this._drawCommands.concat("q;"); + } + + closePath() { + this._drawCommands = this._drawCommands.concat("o;"); + } + + moveTo(x, y) { + this._drawCommands = this._drawCommands.concat("g" + x.toFixed(2) + "," + y.toFixed(2) + ";"); + } + + lineTo(x, y) { + this._drawCommands = this._drawCommands.concat("i" + x.toFixed(2) + "," + y.toFixed(2) + ";"); + } + + quadraticCurveTo = function(cpx, cpy, x, y) { + this._drawCommands = this._drawCommands.concat("u" + cpx + "," + cpy + "," + x + "," + y + ";"); + } + + bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y, ) { + this._drawCommands = this._drawCommands.concat( + "z" + cp1x.toFixed(2) + "," + cp1y.toFixed(2) + "," + cp2x.toFixed(2) + "," + cp2y.toFixed(2) + "," + + x.toFixed(2) + "," + y.toFixed(2) + ";"); + } + + arcTo(x1, y1, x2, y2, radius) { + this._drawCommands = this._drawCommands.concat("h" + x1 + "," + y1 + "," + x2 + "," + y2 + "," + radius + ";"); + } + + beginPath() { + this._drawCommands = this._drawCommands.concat("b;"); + } + + + fillRect(x, y, w, h) { + this._drawCommands = this._drawCommands.concat("n" + x + "," + y + "," + w + + "," + h + ";"); + } + + rect(x, y, w, h) { + this._drawCommands = this._drawCommands.concat("w" + x + "," + y + "," + w + "," + h + ";"); + } + + fill() { + this._drawCommands = this._drawCommands.concat("L;"); + } + + stroke(path) { + this._drawCommands = this._drawCommands.concat("x;"); + } + + arc(x, y, radius, startAngle, endAngle, anticlockwise) { + + let ianticlockwise = 0; + if (anticlockwise) { + ianticlockwise = 1; + } + + this._drawCommands = this._drawCommands.concat( + "y" + x.toFixed(2) + "," + y.toFixed(2) + "," + + radius.toFixed(2) + "," + startAngle + "," + endAngle + "," + ianticlockwise + + ";" + ); + } + + fillText(text, x, y) { + let tmptext = text.replace(/!/g, "!!"); + tmptext = tmptext.replace(/,/g, "!,"); + tmptext = tmptext.replace(/;/g, "!;"); + this._drawCommands = this._drawCommands.concat("T" + tmptext + "," + x + "," + y + ",0.0;"); + } + + strokeText = function(text, x, y) { + let tmptext = text.replace(/!/g, "!!"); + tmptext = tmptext.replace(/,/g, "!,"); + tmptext = tmptext.replace(/;/g, "!;"); + this._drawCommands = this._drawCommands.concat("U" + tmptext + "," + x + "," + y + ",0.0;"); + } + + measureText(text) { + return CanvasRenderingContext2D.GBridge.measureText(text, this.font, this.componentId); + } + + isPointInPath = function(x, y) { + throw new Error('GCanvas not supported yet'); + } + + drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) { + if (typeof image === 'string') { + var imgObj = new GImage(); + imgObj.src = image; + image = imgObj; + } + if (image instanceof GImage) { + if (!image.complete) { + imgObj.onload = () => { + var index = this._needRedrawImageCache.indexOf(image); + if (index > -1) { + this._needRedrawImageCache.splice(index, 1); + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + this._redrawflush(true); + } + } + this._notCommitDrawImageCache.push(image); + } else { + CanvasRenderingContext2D.GBridge.bindImageTexture(this.componentId, image.src, image._id); + } + var srcArgs = [image, sx, sy, sw, sh, dx, dy, dw, dh]; + var args = []; + for (var arg in srcArgs) { + if (typeof(srcArgs[arg]) != 'undefined') { + args.push(srcArgs[arg]); + } + } + this.__drawImage.apply(this, args); + //this.__drawImage(image,sx, sy, sw, sh, dx, dy, dw, dh); + } + } + + __drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh) { + const numArgs = arguments.length; + + function drawImageCommands() { + + if (numArgs === 3) { + const x = parseFloat(sx) || 0.0; + const y = parseFloat(sy) || 0.0; + + return ("d" + image._id + ",0,0," + + image.width + "," + image.height + "," + + x + "," + y + "," + image.width + "," + image.height + ";"); + } else if (numArgs === 5) { + const x = parseFloat(sx) || 0.0; + const y = parseFloat(sy) || 0.0; + const width = parseInt(sw) || image.width; + const height = parseInt(sh) || image.height; + + return ("d" + image._id + ",0,0," + + image.width + "," + image.height + "," + + x + "," + y + "," + width + "," + height + ";"); + } else if (numArgs === 9) { + sx = parseFloat(sx) || 0.0; + sy = parseFloat(sy) || 0.0; + sw = parseInt(sw) || image.width; + sh = parseInt(sh) || image.height; + dx = parseFloat(dx) || 0.0; + dy = parseFloat(dy) || 0.0; + dw = parseInt(dw) || image.width; + dh = parseInt(dh) || image.height; + + return ("d" + image._id + "," + + sx + "," + sy + "," + sw + "," + sh + "," + + dx + "," + dy + "," + dw + "," + dh + ";"); + } + } + this._drawCommands += drawImageCommands(); + } + + _flush(reserve, callback) { + const commands = this._drawCommands; + this._drawCommands = ''; + CanvasRenderingContext2D.GBridge.render2d(this.componentId, commands, callback); + this._needRender = false; + } + + _redrawflush(reserve, callback) { + const commands = this._redrawCommands; + CanvasRenderingContext2D.GBridge.render2d(this.componentId, commands, callback); + if (this._needRedrawImageCache.length == 0) { + this._redrawCommands = ''; + } + } + + draw(reserve, callback) { + if (!reserve) { + this._globalAlpha = this._savedGlobalAlpha.pop(); + this._savedGlobalAlpha.push(this._globalAlpha); + this._redrawCommands = this._drawCommands; + this._needRedrawImageCache = this._notCommitDrawImageCache; + if (this._autoSaveContext) { + this._drawCommands = ("v;" + this._drawCommands); + this._autoSaveContext = false; + } else { + this._drawCommands = ("e;X;v;" + this._drawCommands); + } + } else { + this._needRedrawImageCache = this._needRedrawImageCache.concat(this._notCommitDrawImageCache); + this._redrawCommands += this._drawCommands; + if (this._autoSaveContext) { + this._drawCommands = ("v;" + this._drawCommands); + this._autoSaveContext = false; + } + } + this._notCommitDrawImageCache = []; + if (this._flush) { + this._flush(reserve, callback); + } + } + + getImageData(x, y, w, h, callback) { + CanvasRenderingContext2D.GBridge.getImageData(this.componentId, x, y, w, h, function(res) { + res.data = Base64ToUint8ClampedArray(res.data); + if (typeof(callback) == 'function') { + callback(res); + } + }); + } + + putImageData(data, x, y, w, h, callback) { + if (data instanceof Uint8ClampedArray) { + data = ArrayBufferToBase64(data); + CanvasRenderingContext2D.GBridge.putImageData(this.componentId, data, x, y, w, h, function(res) { + if (typeof(callback) == 'function') { + callback(res); + } + }); + } + } + + toTempFilePath(x, y, width, height, destWidth, destHeight, fileType, quality, callback) { + CanvasRenderingContext2D.GBridge.toTempFilePath(this.componentId, x, y, width, height, destWidth, destHeight, + fileType, quality, + function(res) { + if (typeof(callback) == 'function') { + callback(res); + } + }); + } +} \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/context-webgl/ActiveInfo.js b/components/firstui/fui-circle/gcanvas/context-webgl/ActiveInfo.js new file mode 100644 index 0000000..a334f58 --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/context-webgl/ActiveInfo.js @@ -0,0 +1,12 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1861 4 0 7 25 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +export default class WebGLActiveInfo { + className = 'WebGLActiveInfo'; + + constructor({ + type, name, size + }) { + this.type = type; + this.name = name; + this.size = size; + } +} \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/context-webgl/Buffer.js b/components/firstui/fui-circle/gcanvas/context-webgl/Buffer.js new file mode 100644 index 0000000..26d0873 --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/context-webgl/Buffer.js @@ -0,0 +1,22 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 86 1 4072549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLBuffer'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLBuffer { + className = name; + + constructor(id) { + this.id = id; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/context-webgl/Framebuffer.js b/components/firstui/fui-circle/gcanvas/context-webgl/Framebuffer.js new file mode 100644 index 0000000..e3845c4 --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/context-webgl/Framebuffer.js @@ -0,0 +1,22 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 6 14 07 25 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLFrameBuffer'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLFramebuffer { + className = name; + + constructor(id) { + this.id = id; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/context-webgl/GLenum.js b/components/firstui/fui-circle/gcanvas/context-webgl/GLenum.js new file mode 100644 index 0000000..cca684b --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/context-webgl/GLenum.js @@ -0,0 +1,299 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 614 0 7254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +export default { + "DEPTH_BUFFER_BIT": 256, + "STENCIL_BUFFER_BIT": 1024, + "COLOR_BUFFER_BIT": 16384, + "POINTS": 0, + "LINES": 1, + "LINE_LOOP": 2, + "LINE_STRIP": 3, + "TRIANGLES": 4, + "TRIANGLE_STRIP": 5, + "TRIANGLE_FAN": 6, + "ZERO": 0, + "ONE": 1, + "SRC_COLOR": 768, + "ONE_MINUS_SRC_COLOR": 769, + "SRC_ALPHA": 770, + "ONE_MINUS_SRC_ALPHA": 771, + "DST_ALPHA": 772, + "ONE_MINUS_DST_ALPHA": 773, + "DST_COLOR": 774, + "ONE_MINUS_DST_COLOR": 775, + "SRC_ALPHA_SATURATE": 776, + "FUNC_ADD": 32774, + "BLEND_EQUATION": 32777, + "BLEND_EQUATION_RGB": 32777, + "BLEND_EQUATION_ALPHA": 34877, + "FUNC_SUBTRACT": 32778, + "FUNC_REVERSE_SUBTRACT": 32779, + "BLEND_DST_RGB": 32968, + "BLEND_SRC_RGB": 32969, + "BLEND_DST_ALPHA": 32970, + "BLEND_SRC_ALPHA": 32971, + "CONSTANT_COLOR": 32769, + "ONE_MINUS_CONSTANT_COLOR": 32770, + "CONSTANT_ALPHA": 32771, + "ONE_MINUS_CONSTANT_ALPHA": 32772, + "BLEND_COLOR": 32773, + "ARRAY_BUFFER": 34962, + "ELEMENT_ARRAY_BUFFER": 34963, + "ARRAY_BUFFER_BINDING": 34964, + "ELEMENT_ARRAY_BUFFER_BINDING": 34965, + "STREAM_DRAW": 35040, + "STATIC_DRAW": 35044, + "DYNAMIC_DRAW": 35048, + "BUFFER_SIZE": 34660, + "BUFFER_USAGE": 34661, + "CURRENT_VERTEX_ATTRIB": 34342, + "FRONT": 1028, + "BACK": 1029, + "FRONT_AND_BACK": 1032, + "TEXTURE_2D": 3553, + "CULL_FACE": 2884, + "BLEND": 3042, + "DITHER": 3024, + "STENCIL_TEST": 2960, + "DEPTH_TEST": 2929, + "SCISSOR_TEST": 3089, + "POLYGON_OFFSET_FILL": 32823, + "SAMPLE_ALPHA_TO_COVERAGE": 32926, + "SAMPLE_COVERAGE": 32928, + "NO_ERROR": 0, + "INVALID_ENUM": 1280, + "INVALID_VALUE": 1281, + "INVALID_OPERATION": 1282, + "OUT_OF_MEMORY": 1285, + "CW": 2304, + "CCW": 2305, + "LINE_WIDTH": 2849, + "ALIASED_POINT_SIZE_RANGE": 33901, + "ALIASED_LINE_WIDTH_RANGE": 33902, + "CULL_FACE_MODE": 2885, + "FRONT_FACE": 2886, + "DEPTH_RANGE": 2928, + "DEPTH_WRITEMASK": 2930, + "DEPTH_CLEAR_VALUE": 2931, + "DEPTH_FUNC": 2932, + "STENCIL_CLEAR_VALUE": 2961, + "STENCIL_FUNC": 2962, + "STENCIL_FAIL": 2964, + "STENCIL_PASS_DEPTH_FAIL": 2965, + "STENCIL_PASS_DEPTH_PASS": 2966, + "STENCIL_REF": 2967, + "STENCIL_VALUE_MASK": 2963, + "STENCIL_WRITEMASK": 2968, + "STENCIL_BACK_FUNC": 34816, + "STENCIL_BACK_FAIL": 34817, + "STENCIL_BACK_PASS_DEPTH_FAIL": 34818, + "STENCIL_BACK_PASS_DEPTH_PASS": 34819, + "STENCIL_BACK_REF": 36003, + "STENCIL_BACK_VALUE_MASK": 36004, + "STENCIL_BACK_WRITEMASK": 36005, + "VIEWPORT": 2978, + "SCISSOR_BOX": 3088, + "COLOR_CLEAR_VALUE": 3106, + "COLOR_WRITEMASK": 3107, + "UNPACK_ALIGNMENT": 3317, + "PACK_ALIGNMENT": 3333, + "MAX_TEXTURE_SIZE": 3379, + "MAX_VIEWPORT_DIMS": 3386, + "SUBPIXEL_BITS": 3408, + "RED_BITS": 3410, + "GREEN_BITS": 3411, + "BLUE_BITS": 3412, + "ALPHA_BITS": 3413, + "DEPTH_BITS": 3414, + "STENCIL_BITS": 3415, + "POLYGON_OFFSET_UNITS": 10752, + "POLYGON_OFFSET_FACTOR": 32824, + "TEXTURE_BINDING_2D": 32873, + "SAMPLE_BUFFERS": 32936, + "SAMPLES": 32937, + "SAMPLE_COVERAGE_VALUE": 32938, + "SAMPLE_COVERAGE_INVERT": 32939, + "COMPRESSED_TEXTURE_FORMATS": 34467, + "DONT_CARE": 4352, + "FASTEST": 4353, + "NICEST": 4354, + "GENERATE_MIPMAP_HINT": 33170, + "BYTE": 5120, + "UNSIGNED_BYTE": 5121, + "SHORT": 5122, + "UNSIGNED_SHORT": 5123, + "INT": 5124, + "UNSIGNED_INT": 5125, + "FLOAT": 5126, + "DEPTH_COMPONENT": 6402, + "ALPHA": 6406, + "RGB": 6407, + "RGBA": 6408, + "LUMINANCE": 6409, + "LUMINANCE_ALPHA": 6410, + "UNSIGNED_SHORT_4_4_4_4": 32819, + "UNSIGNED_SHORT_5_5_5_1": 32820, + "UNSIGNED_SHORT_5_6_5": 33635, + "FRAGMENT_SHADER": 35632, + "VERTEX_SHADER": 35633, + "MAX_VERTEX_ATTRIBS": 34921, + "MAX_VERTEX_UNIFORM_VECTORS": 36347, + "MAX_VARYING_VECTORS": 36348, + "MAX_COMBINED_TEXTURE_IMAGE_UNITS": 35661, + "MAX_VERTEX_TEXTURE_IMAGE_UNITS": 35660, + "MAX_TEXTURE_IMAGE_UNITS": 34930, + "MAX_FRAGMENT_UNIFORM_VECTORS": 36349, + "SHADER_TYPE": 35663, + "DELETE_STATUS": 35712, + "LINK_STATUS": 35714, + "VALIDATE_STATUS": 35715, + "ATTACHED_SHADERS": 35717, + "ACTIVE_UNIFORMS": 35718, + "ACTIVE_ATTRIBUTES": 35721, + "SHADING_LANGUAGE_VERSION": 35724, + "CURRENT_PROGRAM": 35725, + "NEVER": 512, + "LESS": 513, + "EQUAL": 514, + "LEQUAL": 515, + "GREATER": 516, + "NOTEQUAL": 517, + "GEQUAL": 518, + "ALWAYS": 519, + "KEEP": 7680, + "REPLACE": 7681, + "INCR": 7682, + "DECR": 7683, + "INVERT": 5386, + "INCR_WRAP": 34055, + "DECR_WRAP": 34056, + "VENDOR": 7936, + "RENDERER": 7937, + "VERSION": 7938, + "NEAREST": 9728, + "LINEAR": 9729, + "NEAREST_MIPMAP_NEAREST": 9984, + "LINEAR_MIPMAP_NEAREST": 9985, + "NEAREST_MIPMAP_LINEAR": 9986, + "LINEAR_MIPMAP_LINEAR": 9987, + "TEXTURE_MAG_FILTER": 10240, + "TEXTURE_MIN_FILTER": 10241, + "TEXTURE_WRAP_S": 10242, + "TEXTURE_WRAP_T": 10243, + "TEXTURE": 5890, + "TEXTURE_CUBE_MAP": 34067, + "TEXTURE_BINDING_CUBE_MAP": 34068, + "TEXTURE_CUBE_MAP_POSITIVE_X": 34069, + "TEXTURE_CUBE_MAP_NEGATIVE_X": 34070, + "TEXTURE_CUBE_MAP_POSITIVE_Y": 34071, + "TEXTURE_CUBE_MAP_NEGATIVE_Y": 34072, + "TEXTURE_CUBE_MAP_POSITIVE_Z": 34073, + "TEXTURE_CUBE_MAP_NEGATIVE_Z": 34074, + "MAX_CUBE_MAP_TEXTURE_SIZE": 34076, + "TEXTURE0": 33984, + "TEXTURE1": 33985, + "TEXTURE2": 33986, + "TEXTURE3": 33987, + "TEXTURE4": 33988, + "TEXTURE5": 33989, + "TEXTURE6": 33990, + "TEXTURE7": 33991, + "TEXTURE8": 33992, + "TEXTURE9": 33993, + "TEXTURE10": 33994, + "TEXTURE11": 33995, + "TEXTURE12": 33996, + "TEXTURE13": 33997, + "TEXTURE14": 33998, + "TEXTURE15": 33999, + "TEXTURE16": 34000, + "TEXTURE17": 34001, + "TEXTURE18": 34002, + "TEXTURE19": 34003, + "TEXTURE20": 34004, + "TEXTURE21": 34005, + "TEXTURE22": 34006, + "TEXTURE23": 34007, + "TEXTURE24": 34008, + "TEXTURE25": 34009, + "TEXTURE26": 34010, + "TEXTURE27": 34011, + "TEXTURE28": 34012, + "TEXTURE29": 34013, + "TEXTURE30": 34014, + "TEXTURE31": 34015, + "ACTIVE_TEXTURE": 34016, + "REPEAT": 10497, + "CLAMP_TO_EDGE": 33071, + "MIRRORED_REPEAT": 33648, + "FLOAT_VEC2": 35664, + "FLOAT_VEC3": 35665, + "FLOAT_VEC4": 35666, + "INT_VEC2": 35667, + "INT_VEC3": 35668, + "INT_VEC4": 35669, + "BOOL": 35670, + "BOOL_VEC2": 35671, + "BOOL_VEC3": 35672, + "BOOL_VEC4": 35673, + "FLOAT_MAT2": 35674, + "FLOAT_MAT3": 35675, + "FLOAT_MAT4": 35676, + "SAMPLER_2D": 35678, + "SAMPLER_CUBE": 35680, + "VERTEX_ATTRIB_ARRAY_ENABLED": 34338, + "VERTEX_ATTRIB_ARRAY_SIZE": 34339, + "VERTEX_ATTRIB_ARRAY_STRIDE": 34340, + "VERTEX_ATTRIB_ARRAY_TYPE": 34341, + "VERTEX_ATTRIB_ARRAY_NORMALIZED": 34922, + "VERTEX_ATTRIB_ARRAY_POINTER": 34373, + "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING": 34975, + "IMPLEMENTATION_COLOR_READ_TYPE": 35738, + "IMPLEMENTATION_COLOR_READ_FORMAT": 35739, + "COMPILE_STATUS": 35713, + "LOW_FLOAT": 36336, + "MEDIUM_FLOAT": 36337, + "HIGH_FLOAT": 36338, + "LOW_INT": 36339, + "MEDIUM_INT": 36340, + "HIGH_INT": 36341, + "FRAMEBUFFER": 36160, + "RENDERBUFFER": 36161, + "RGBA4": 32854, + "RGB5_A1": 32855, + "RGB565": 36194, + "DEPTH_COMPONENT16": 33189, + "STENCIL_INDEX8": 36168, + "DEPTH_STENCIL": 34041, + "RENDERBUFFER_WIDTH": 36162, + "RENDERBUFFER_HEIGHT": 36163, + "RENDERBUFFER_INTERNAL_FORMAT": 36164, + "RENDERBUFFER_RED_SIZE": 36176, + "RENDERBUFFER_GREEN_SIZE": 36177, + "RENDERBUFFER_BLUE_SIZE": 36178, + "RENDERBUFFER_ALPHA_SIZE": 36179, + "RENDERBUFFER_DEPTH_SIZE": 36180, + "RENDERBUFFER_STENCIL_SIZE": 36181, + "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE": 36048, + "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME": 36049, + "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL": 36050, + "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE": 36051, + "COLOR_ATTACHMENT0": 36064, + "DEPTH_ATTACHMENT": 36096, + "STENCIL_ATTACHMENT": 36128, + "DEPTH_STENCIL_ATTACHMENT": 33306, + "NONE": 0, + "FRAMEBUFFER_COMPLETE": 36053, + "FRAMEBUFFER_INCOMPLETE_ATTACHMENT": 36054, + "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT": 36055, + "FRAMEBUFFER_INCOMPLETE_DIMENSIONS": 36057, + "FRAMEBUFFER_UNSUPPORTED": 36061, + "FRAMEBUFFER_BINDING": 36006, + "RENDERBUFFER_BINDING": 36007, + "MAX_RENDERBUFFER_SIZE": 34024, + "INVALID_FRAMEBUFFER_OPERATION": 1286, + "UNPACK_FLIP_Y_WEBGL": 37440, + "UNPACK_PREMULTIPLY_ALPHA_WEBGL": 37441, + "CONTEXT_LOST_WEBGL": 37442, + "UNPACK_COLORSPACE_CONVERSION_WEBGL": 37443, + "BROWSER_DEFAULT_WEBGL": 37444 +}; \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/context-webgl/GLmethod.js b/components/firstui/fui-circle/gcanvas/context-webgl/GLmethod.js new file mode 100644 index 0000000..55f8cf7 --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/context-webgl/GLmethod.js @@ -0,0 +1,143 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8614 07 2 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +let i = 1; + +const GLmethod = {}; + +GLmethod.activeTexture = i++; //1 +GLmethod.attachShader = i++; +GLmethod.bindAttribLocation = i++; +GLmethod.bindBuffer = i++; +GLmethod.bindFramebuffer = i++; +GLmethod.bindRenderbuffer = i++; +GLmethod.bindTexture = i++; +GLmethod.blendColor = i++; +GLmethod.blendEquation = i++; +GLmethod.blendEquationSeparate = i++; //10 +GLmethod.blendFunc = i++; +GLmethod.blendFuncSeparate = i++; +GLmethod.bufferData = i++; +GLmethod.bufferSubData = i++; +GLmethod.checkFramebufferStatus = i++; +GLmethod.clear = i++; +GLmethod.clearColor = i++; +GLmethod.clearDepth = i++; +GLmethod.clearStencil = i++; +GLmethod.colorMask = i++; //20 +GLmethod.compileShader = i++; +GLmethod.compressedTexImage2D = i++; +GLmethod.compressedTexSubImage2D = i++; +GLmethod.copyTexImage2D = i++; +GLmethod.copyTexSubImage2D = i++; +GLmethod.createBuffer = i++; +GLmethod.createFramebuffer = i++; +GLmethod.createProgram = i++; +GLmethod.createRenderbuffer = i++; +GLmethod.createShader = i++; //30 +GLmethod.createTexture = i++; +GLmethod.cullFace = i++; +GLmethod.deleteBuffer = i++; +GLmethod.deleteFramebuffer = i++; +GLmethod.deleteProgram = i++; +GLmethod.deleteRenderbuffer = i++; +GLmethod.deleteShader = i++; +GLmethod.deleteTexture = i++; +GLmethod.depthFunc = i++; +GLmethod.depthMask = i++; //40 +GLmethod.depthRange = i++; +GLmethod.detachShader = i++; +GLmethod.disable = i++; +GLmethod.disableVertexAttribArray = i++; +GLmethod.drawArrays = i++; +GLmethod.drawArraysInstancedANGLE = i++; +GLmethod.drawElements = i++; +GLmethod.drawElementsInstancedANGLE = i++; +GLmethod.enable = i++; +GLmethod.enableVertexAttribArray = i++; //50 +GLmethod.flush = i++; +GLmethod.framebufferRenderbuffer = i++; +GLmethod.framebufferTexture2D = i++; +GLmethod.frontFace = i++; +GLmethod.generateMipmap = i++; +GLmethod.getActiveAttrib = i++; +GLmethod.getActiveUniform = i++; +GLmethod.getAttachedShaders = i++; +GLmethod.getAttribLocation = i++; +GLmethod.getBufferParameter = i++; //60 +GLmethod.getContextAttributes = i++; +GLmethod.getError = i++; +GLmethod.getExtension = i++; +GLmethod.getFramebufferAttachmentParameter = i++; +GLmethod.getParameter = i++; +GLmethod.getProgramInfoLog = i++; +GLmethod.getProgramParameter = i++; +GLmethod.getRenderbufferParameter = i++; +GLmethod.getShaderInfoLog = i++; +GLmethod.getShaderParameter = i++; //70 +GLmethod.getShaderPrecisionFormat = i++; +GLmethod.getShaderSource = i++; +GLmethod.getSupportedExtensions = i++; +GLmethod.getTexParameter = i++; +GLmethod.getUniform = i++; +GLmethod.getUniformLocation = i++; +GLmethod.getVertexAttrib = i++; +GLmethod.getVertexAttribOffset = i++; +GLmethod.isBuffer = i++; +GLmethod.isContextLost = i++; //80 +GLmethod.isEnabled = i++; +GLmethod.isFramebuffer = i++; +GLmethod.isProgram = i++; +GLmethod.isRenderbuffer = i++; +GLmethod.isShader = i++; +GLmethod.isTexture = i++; +GLmethod.lineWidth = i++; +GLmethod.linkProgram = i++; +GLmethod.pixelStorei = i++; +GLmethod.polygonOffset = i++; //90 +GLmethod.readPixels = i++; +GLmethod.renderbufferStorage = i++; +GLmethod.sampleCoverage = i++; +GLmethod.scissor = i++; +GLmethod.shaderSource = i++; +GLmethod.stencilFunc = i++; +GLmethod.stencilFuncSeparate = i++; +GLmethod.stencilMask = i++; +GLmethod.stencilMaskSeparate = i++; +GLmethod.stencilOp = i++; //100 +GLmethod.stencilOpSeparate = i++; +GLmethod.texImage2D = i++; +GLmethod.texParameterf = i++; +GLmethod.texParameteri = i++; +GLmethod.texSubImage2D = i++; +GLmethod.uniform1f = i++; +GLmethod.uniform1fv = i++; +GLmethod.uniform1i = i++; +GLmethod.uniform1iv = i++; +GLmethod.uniform2f = i++; //110 +GLmethod.uniform2fv = i++; +GLmethod.uniform2i = i++; +GLmethod.uniform2iv = i++; +GLmethod.uniform3f = i++; +GLmethod.uniform3fv = i++; +GLmethod.uniform3i = i++; +GLmethod.uniform3iv = i++; +GLmethod.uniform4f = i++; +GLmethod.uniform4fv = i++; +GLmethod.uniform4i = i++; //120 +GLmethod.uniform4iv = i++; +GLmethod.uniformMatrix2fv = i++; +GLmethod.uniformMatrix3fv = i++; +GLmethod.uniformMatrix4fv = i++; +GLmethod.useProgram = i++; +GLmethod.validateProgram = i++; +GLmethod.vertexAttrib1f = i++; //new +GLmethod.vertexAttrib2f = i++; //new +GLmethod.vertexAttrib3f = i++; //new +GLmethod.vertexAttrib4f = i++; //new //130 +GLmethod.vertexAttrib1fv = i++; //new +GLmethod.vertexAttrib2fv = i++; //new +GLmethod.vertexAttrib3fv = i++; //new +GLmethod.vertexAttrib4fv = i++; //new +GLmethod.vertexAttribPointer = i++; +GLmethod.viewport = i++; + +export default GLmethod; \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/context-webgl/GLtype.js b/components/firstui/fui-circle/gcanvas/context-webgl/GLtype.js new file mode 100644 index 0000000..e05a841 --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/context-webgl/GLtype.js @@ -0,0 +1,23 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 186 14 0 72 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +const GLtype = {}; + +[ + "GLbitfield", + "GLboolean", + "GLbyte", + "GLclampf", + "GLenum", + "GLfloat", + "GLint", + "GLintptr", + "GLsizei", + "GLsizeiptr", + "GLshort", + "GLubyte", + "GLuint", + "GLushort" +].sort().map((typeName, i) => GLtype[typeName] = 1 >> (i + 1)); + +export default GLtype; + + diff --git a/components/firstui/fui-circle/gcanvas/context-webgl/Program.js b/components/firstui/fui-circle/gcanvas/context-webgl/Program.js new file mode 100644 index 0000000..0d55d2c --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/context-webgl/Program.js @@ -0,0 +1,22 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:186 1 407 2 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLProgram'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLProgram { + className = name; + + constructor(id) { + this.id = id; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/context-webgl/Renderbuffer.js b/components/firstui/fui-circle/gcanvas/context-webgl/Renderbuffer.js new file mode 100644 index 0000000..3888866 --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/context-webgl/Renderbuffer.js @@ -0,0 +1,22 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 186140 7 2 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLRenderBuffer'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLRenderbuffer { + className = name; + + constructor(id) { + this.id = id; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/context-webgl/RenderingContext.js b/components/firstui/fui-circle/gcanvas/context-webgl/RenderingContext.js new file mode 100644 index 0000000..f941b7b --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/context-webgl/RenderingContext.js @@ -0,0 +1,1192 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 6 1 4 0 7254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import GLenum from './GLenum'; +import ActiveInfo from './ActiveInfo'; +import Buffer from './Buffer'; +import Framebuffer from './Framebuffer'; +import Renderbuffer from './Renderbuffer'; +import Texture from './Texture'; +import Program from './Program'; +import Shader from './Shader'; +import ShaderPrecisionFormat from './ShaderPrecisionFormat'; +import UniformLocation from './UniformLocation'; +import GLmethod from './GLmethod'; + +const processArray = (array, checkArrayType = false) => { + + function joinArray(arr, sep) { + let res = ''; + for (let i = 0; i < arr.length; i++) { + if (i !== 0) { + res += sep; + } + res += arr[i]; + } + return res; + } + + let type = 'Float32Array'; + if (checkArrayType) { + if (array instanceof Uint8Array) { + type = 'Uint8Array' + } else if (array instanceof Uint16Array) { + type = 'Uint16Array'; + } else if (array instanceof Uint32Array) { + type = 'Uint32Array'; + } else if (array instanceof Float32Array) { + type = 'Float32Array'; + } else { + throw new Error('Check array type failed. Array type is ' + typeof array); + } + } + + const ArrayTypes = { + Uint8Array: 1, + Uint16Array: 2, + Uint32Array: 4, + Float32Array: 14 + }; + return ArrayTypes[type] + ',' + btoa(joinArray(array, ',')) +} + +export default class WebGLRenderingContext { + + // static GBridge = null; + + className = 'WebGLRenderingContext'; + + constructor(canvas, type, attrs) { + this._canvas = canvas; + this._type = type; + this._version = 'WebGL 1.0'; + this._attrs = attrs; + this._map = new Map(); + + Object.keys(GLenum) + .forEach(name => Object.defineProperty(this, name, { + value: GLenum[name] + })); + } + + get canvas() { + return this._canvas; + } + + activeTexture = function (textureUnit) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.activeTexture + ',' + textureUnit, + true + ); + } + + attachShader = function (progarm, shader) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.attachShader + ',' + progarm.id + ',' + shader.id, + true + ); + } + + bindAttribLocation = function (program, index, name) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindAttribLocation + ',' + program.id + ',' + index + ',' + name, + true + ) + } + + bindBuffer = function (target, buffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindBuffer + ',' + target + ',' + (buffer ? buffer.id : 0), + true + ); + } + + bindFramebuffer = function (target, framebuffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindFramebuffer + ',' + target + ',' + (framebuffer ? framebuffer.id : 0), + true + ) + } + + bindRenderbuffer = function (target, renderBuffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindRenderbuffer + ',' + target + ',' + (renderBuffer ? renderBuffer.id : 0), + true + ) + } + + bindTexture = function (target, texture) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bindTexture + ',' + target + ',' + (texture ? texture.id : 0), + true + ) + } + + blendColor = function (r, g, b, a) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendColor + ',' + target + ',' + r + ',' + g + ',' + b + ',' + a, + true + ) + } + + blendEquation = function (mode) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendEquation + ',' + mode, + true + ) + } + + blendEquationSeparate = function (modeRGB, modeAlpha) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendEquationSeparate + ',' + modeRGB + ',' + modeAlpha, + true + ) + } + + + blendFunc = function (sfactor, dfactor) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendFunc + ',' + sfactor + ',' + dfactor, + true + ); + } + + blendFuncSeparate = function (srcRGB, dstRGB, srcAlpha, dstAlpha) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.blendFuncSeparate + ',' + srcRGB + ',' + dstRGB + ',' + srcAlpha + ',' + dstAlpha, + true + ); + } + + bufferData = function (target, data, usage) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bufferData + ',' + target + ',' + processArray(data, true) + ',' + usage, + true + ) + } + + bufferSubData = function (target, offset, data) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.bufferSubData + ',' + target + ',' + offset + ',' + processArray(data, true), + true + ) + } + + checkFramebufferStatus = function (target) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.checkFramebufferStatus + ',' + target + ); + return Number(result); + } + + clear = function (mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.clear + ',' + mask + ); + this._canvas._needRender = true; + } + + clearColor = function (r, g, b, a) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.clearColor + ',' + r + ',' + g + ',' + b, + true + ) + } + + clearDepth = function (depth) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.clearDepth + ',' + depth, + true + ) + } + + clearStencil = function (s) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.clearStencil + ',' + s + ); + } + + colorMask = function (r, g, b, a) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.colorMask + ',' + r + ',' + g + ',' + b + ',' + a + ) + } + + compileShader = function (shader) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.compileShader + ',' + shader.id, + true + ) + } + + compressedTexImage2D = function (target, level, internalformat, width, height, border, pixels) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.compressedTexImage2D + ',' + target + ',' + level + ',' + internalformat + ',' + + width + ',' + height + ',' + border + ',' + processArray(pixels), + true + ) + } + + compressedTexSubImage2D = function (target, level, xoffset, yoffset, width, height, format, pixels) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.compressedTexSubImage2D + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset + ',' + + width + ',' + height + ',' + format + ',' + processArray(pixels), + true + ) + } + + + copyTexImage2D = function (target, level, internalformat, x, y, width, height, border) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.copyTexImage2D + ',' + target + ',' + level + ',' + internalformat + ',' + x + ',' + y + ',' + + width + ',' + height + ',' + border, + true + ); + } + + copyTexSubImage2D = function (target, level, xoffset, yoffset, x, y, width, height) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.copyTexSubImage2D + ',' + target + ',' + level + ',' + xoffset + ',' + yoffset + ',' + x + ',' + y + ',' + + width + ',' + height + ); + } + + createBuffer = function () { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createBuffer + '' + ); + const buffer = new Buffer(result); + this._map.set(buffer.uuid(), buffer); + return buffer; + } + + createFramebuffer = function () { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createFramebuffer + '' + ); + const framebuffer = new Framebuffer(result); + this._map.set(framebuffer.uuid(), framebuffer); + return framebuffer; + } + + + createProgram = function () { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createProgram + '' + ); + const program = new Program(id); + this._map.set(program.uuid(), program); + return program; + } + + createRenderbuffer = function () { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createRenderbuffer + '' + ) + const renderBuffer = new Renderbuffer(id); + this._map.set(renderBuffer.uuid(), renderBuffer); + return renderBuffer; + } + + createShader = function (type) { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createShader + ',' + type + ) + const shader = new Shader(id, type); + this._map.set(shader.uuid(), shader); + return shader; + } + + createTexture = function () { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.createTexture + '' + ); + const texture = new Texture(id); + this._map.set(texture.uuid(), texture); + return texture; + } + + cullFace = function (mode) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.cullFace + ',' + mode, + true + ) + } + + + deleteBuffer = function (buffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteBuffer + ',' + buffer.id, + true + ) + } + + deleteFramebuffer = function (framebuffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteFramebuffer + ',' + framebuffer.id, + true + ) + } + + deleteProgram = function (program) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteProgram + ',' + program.id, + true + ) + } + + deleteRenderbuffer = function (renderbuffer) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteRenderbuffer + ',' + renderbuffer.id, + true + ) + } + + deleteShader = function (shader) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteShader + ',' + shader.id, + true + ) + } + + deleteTexture = function (texture) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.deleteTexture + ',' + texture.id, + true + ) + } + + depthFunc = function (func) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.depthFunc + ',' + func + ) + } + + depthMask = function (flag) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.depthMask + ',' + Number(flag), + true + ) + } + + depthRange = function (zNear, zFar) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.depthRange + ',' + zNear + ',' + zFar, + true + ) + } + + detachShader = function (program, shader) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.detachShader + ',' + program.id + ',' + shader.id, + true + ) + } + + disable = function (cap) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.disable + ',' + cap, + true + ) + } + + disableVertexAttribArray = function (index) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.disableVertexAttribArray + ',' + index, + true + ); + } + + drawArrays = function (mode, first, count) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.drawArrays + ',' + mode + ',' + first + ',' + count + ) + this._canvas._needRender = true; + } + + drawElements = function (mode, count, type, offset) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.drawElements + ',' + mode + ',' + count + ',' + type + ',' + offset + ';' + ); + this._canvas._needRender = true; + } + + enable = function (cap) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.enable + ',' + cap, + true + ); + } + + enableVertexAttribArray = function (index) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.enableVertexAttribArray + ',' + index, + true + ) + } + + + flush = function () { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.flush + '' + ) + } + + framebufferRenderbuffer = function (target, attachment, textarget, texture, level) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.framebufferRenderbuffer + ',' + target + ',' + attachment + ',' + textarget + ',' + (texture ? texture.id : 0) + ',' + level, + true + ) + } + + framebufferTexture2D = function (target, attachment, textarget, texture, level) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.framebufferTexture2D + ',' + target + ',' + attachment + ',' + textarget + ',' + (texture ? texture.id : 0) + ',' + level, + true + ) + } + + frontFace = function (mode) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.frontFace + ',' + mode, + true + ) + } + + generateMipmap = function (target) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.generateMipmap + ',' + target, + true + ) + } + + getActiveAttrib = function (progarm, index) { + const resultString = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getActiveAttrib + ',' + progarm.id + ',' + index + ) + const [type, size, name] = resultString.split(','); + return new ActiveInfo({ + type: Number(type), + size: Number(size), + name + }); + } + + getActiveUniform = function (progarm, index) { + const resultString = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getActiveUniform + ',' + progarm.id + ',' + index + ); + const [type, size, name] = resultString.split(','); + return new ActiveInfo({ + type: Number(type), + size: Number(size), + name + }) + } + + getAttachedShaders = function (progarm) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getAttachedShaders + ',' + progarm.id + ); + const [type, ...ids] = result; + return ids.map(id => this._map.get(Shader.uuid(id))); + } + + getAttribLocation = function (progarm, name) { + return WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getAttribLocation + ',' + progarm.id + ',' + name + ) + } + + getBufferParameter = function (target, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getBufferParameter + ',' + target + ',' + pname + ); + const [type, res] = getBufferParameter; + return res; + } + + getError = function () { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getError + '' + ) + return result; + } + + getExtension = function (name) { + return null; + } + + getFramebufferAttachmentParameter = function (target, attachment, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getFramebufferAttachmentParameter + ',' + target + ',' + attachment + ',' + pname + ) + switch (pname) { + case GLenum.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: + return this._map.get(Renderbuffer.uuid(result)) || this._map.get(Texture.uuid(result)) || null; + default: + return result; + } + } + + getParameter = function (pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getParameter + ',' + pname + ) + switch (pname) { + case GLenum.VERSION: + return this._version; + case GLenum.ARRAY_BUFFER_BINDING: // buffer + case GLenum.ELEMENT_ARRAY_BUFFER_BINDING: // buffer + return this._map.get(Buffer.uuid(result)) || null; + case GLenum.CURRENT_PROGRAM: // program + return this._map.get(Program.uuid(result)) || null; + case GLenum.FRAMEBUFFER_BINDING: // framebuffer + return this._map.get(Framebuffer.uuid(result)) || null; + case GLenum.RENDERBUFFER_BINDING: // renderbuffer + return this._map.get(Renderbuffer.uuid(result)) || null; + case GLenum.TEXTURE_BINDING_2D: // texture + case GLenum.TEXTURE_BINDING_CUBE_MAP: // texture + return this._map.get(Texture.uuid(result)) || null; + case GLenum.ALIASED_LINE_WIDTH_RANGE: // Float32Array + case GLenum.ALIASED_POINT_SIZE_RANGE: // Float32Array + case GLenum.BLEND_COLOR: // Float32Array + case GLenum.COLOR_CLEAR_VALUE: // Float32Array + case GLenum.DEPTH_RANGE: // Float32Array + case GLenum.MAX_VIEWPORT_DIMS: // Int32Array + case GLenum.SCISSOR_BOX: // Int32Array + case GLenum.VIEWPORT: // Int32Array + case GLenum.COMPRESSED_TEXTURE_FORMATS: // Uint32Array + default: + const [type, ...res] = result.split(','); + if (res.length === 1) { + return Number(res[0]); + } else { + return res.map(Number); + } + } + } + + getProgramInfoLog = function (progarm) { + return WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getProgramInfoLog + ',' + progarm.id + ) + } + + getProgramParameter = function (program, pname) { + const res = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getProgramParameter + ',' + program.id + ',' + pname + ); + + const [type, result] = res.split(',').map(i => parseInt(i)); + + if (type === 1) { + return Boolean(result); + } else if (type === 2) { + return result; + } else { + throw new Error('Unrecongized program paramater ' + res + ', type: ' + typeof res); + } + } + + + getRenderbufferParameter = function (target, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getRenderbufferParameter + ',' + target + ',' + pname + ) + return result; + } + + + getShaderInfoLog = function (shader) { + return WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getShaderInfoLog + ',' + shader.id + ); + } + + getShaderParameter = function (shader, pname) { + return WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getShaderParameter + ',' + shader.id + ',' + pname + ) + } + + getShaderPrecisionFormat = function (shaderType, precisionType) { + const [rangeMin, rangeMax, precision] = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getShaderPrecisionFormat + ',' + shaderType + ',' + precisionType + ); + const shaderPrecisionFormat = new ShaderPrecisionFormat({ + rangeMin: Number(rangeMin), + rangeMax: Number(rangeMax), + precision: Number(precision) + }); + return shaderPrecisionFormat; + } + + getShaderSource = function (shader) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getShaderSource + ',' + shader.id + ); + return result; + } + + getSupportedExtensions = function () { + return Object.keys({}); + } + + getTexParameter = function (target, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getTexParameter + ',' + target + ',' + pname + ) + return result; + } + + getUniformLocation = function (program, name) { + const id = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getUniformLocation + ',' + program.id + ',' + name + ); + if (id === -1) { + return null; + } else { + return new UniformLocation(Number(id)); + } + } + + getVertexAttrib = function (index, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getVertexAttrib + ',' + index + ',' + pname + ); + switch (pname) { + case GLenum.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: + return this._map.get(Buffer.uuid(result)) || null; + case GLenum.CURRENT_VERTEX_ATTRIB: // Float32Array + default: + return result; + } + } + + getVertexAttribOffset = function (index, pname) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.getVertexAttribOffset + ',' + index + ',' + pname + ) + return Number(result); + } + + isBuffer = function (buffer) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isBuffer + ',' + buffer.id + ) + return Boolean(result); + } + + isContextLost = function () { + return false; + } + + isEnabled = function (cap) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isEnabled + ',' + cap + ) + return Boolean(result); + } + + isFramebuffer = function (framebuffer) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isFramebuffer + ',' + framebuffer.id + ) + return Boolean(result); + } + + isProgram = function (program) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isProgram + ',' + program.id + ) + return Boolean(result); + } + + isRenderbuffer = function (renderBuffer) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isRenderbuffer + ',' + renderbuffer.id + ) + return Boolean(result); + } + + isShader = function (shader) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isShader + ',' + shader.id + ) + return Boolean(result); + } + + isTexture = function (texture) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.isTexture + ',' + texture.id + ); + return Boolean(result); + } + + lineWidth = function (width) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.lineWidth + ',' + width, + true + ) + } + + linkProgram = function (program) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.linkProgram + ',' + program.id, + true + ); + } + + + pixelStorei = function (pname, param) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.pixelStorei + ',' + pname + ',' + Number(param) + ) + } + + polygonOffset = function (factor, units) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.polygonOffset + ',' + factor + ',' + units + ) + } + + readPixels = function (x, y, width, height, format, type, pixels) { + const result = WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.readPixels + ',' + x + ',' + y + ',' + width + ',' + height + ',' + format + ',' + type + ) + return result; + } + + renderbufferStorage = function (target, internalFormat, width, height) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.renderbufferStorage + ',' + target + ',' + internalFormat + ',' + width + ',' + height, + true + ) + } + + sampleCoverage = function (value, invert) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.sampleCoverage + ',' + value + ',' + Number(invert), + true + ) + } + + scissor = function (x, y, width, height) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.scissor + ',' + x + ',' + y + ',' + width + ',' + height, + true + ) + } + + shaderSource = function (shader, source) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.shaderSource + ',' + shader.id + ',' + source + ) + } + + stencilFunc = function (func, ref, mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilFunc + ',' + func + ',' + ref + ',' + mask, + true + ) + } + + stencilFuncSeparate = function (face, func, ref, mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilFuncSeparate + ',' + face + ',' + func + ',' + ref + ',' + mask, + true + ) + } + + stencilMask = function (mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilMask + ',' + mask, + true + ) + } + + stencilMaskSeparate = function (face, mask) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilMaskSeparate + ',' + face + ',' + mask, + true + ) + } + + stencilOp = function (fail, zfail, zpass) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilOp + ',' + fail + ',' + zfail + ',' + zpass + ) + } + + stencilOpSeparate = function (face, fail, zfail, zpass) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.stencilOp + ',' + face + ',' + fail + ',' + zfail + ',' + zpass, + true + ) + } + + texImage2D = function (...args) { + WebGLRenderingContext.GBridge.texImage2D(this._canvas.id, ...args); + } + + + texParameterf = function (target, pname, param) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.texParameterf + ',' + target + ',' + pname + ',' + param, + true + ) + } + + texParameteri = function (target, pname, param) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.texParameteri + ',' + target + ',' + pname + ',' + param + ) + } + + texSubImage2D = function (...args) { + WebGLRenderingContext.GBridge.texSubImage2D(this._canvas.id, ...args); + } + + uniform1f = function (location, v0) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform1f + ',' + location.id + ',' + v0 + ) + } + + uniform1fv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform1fv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform1i = function (location, v0) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform1i + ',' + location.id + ',' + v0, + // true + ) + } + + uniform1iv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform1iv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform2f = function (location, v0, v1) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform2f + ',' + location.id + ',' + v0 + ',' + v1, + true + ) + } + + uniform2fv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform2fv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform2i = function (location, v0, v1) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform2i + ',' + location.id + ',' + v0 + ',' + v1, + true + ) + } + + uniform2iv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform2iv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform3f = function (location, v0, v1, v2) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform3f + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2, + true + ) + } + + uniform3fv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform3fv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform3i = function (location, v0, v1, v2) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform3i + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2, + true + ) + } + + uniform3iv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform3iv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform4f = function (location, v0, v1, v2, v3) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform4f + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2 + ',' + v3, + true + ) + } + + uniform4fv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform4fv + ',' + location.id + ',' + processArray(value), + true + ) + } + + uniform4i = function (location, v0, v1, v2, v3) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform4i + ',' + location.id + ',' + v0 + ',' + v1 + ',' + v2 + ',' + v3, + true + ) + } + + uniform4iv = function (location, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniform4iv + ',' + location.id + ',' + processArray(value, true), + true + ) + } + + uniformMatrix2fv = function (location, transpose, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniformMatrix2fv + ',' + location.id + ',' + Number(transpose) + ',' + processArray(value), + true + ) + } + + uniformMatrix3fv = function (location, transpose, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniformMatrix3fv + ',' + location.id + ',' + Number(transpose) + ',' + processArray(value), + true + ) + } + + uniformMatrix4fv = function (location, transpose, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.uniformMatrix4fv + ',' + location.id + ',' + Number(transpose) + ',' + processArray(value), + true + ); + } + + useProgram = function (progarm) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.useProgram + ',' + progarm.id + '', + true + ) + } + + + validateProgram = function (program) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.validateProgram + ',' + program.id, + true + ) + } + + vertexAttrib1f = function (index, v0) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib1f + ',' + index + ',' + v0, + true + ) + } + + vertexAttrib2f = function (index, v0, v1) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib2f + ',' + index + ',' + v0 + ',' + v1, + true + ) + } + + vertexAttrib3f = function (index, v0, v1, v2) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib3f + ',' + index + ',' + v0 + ',' + v1 + ',' + v2, + true + ) + } + + vertexAttrib4f = function (index, v0, v1, v2, v3) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib4f + ',' + index + ',' + v0 + ',' + v1 + ',' + v2 + ',' + v3, + true + ) + } + + vertexAttrib1fv = function (index, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib1fv + ',' + index + ',' + processArray(value), + true + ) + } + + vertexAttrib2fv = function (index, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib2fv + ',' + index + ',' + processArray(value), + true + ) + } + + vertexAttrib3fv = function (index, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib3fv + ',' + index + ',' + processArray(value), + true + ) + } + + vertexAttrib4fv = function (index, value) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttrib4fv + ',' + index + ',' + processArray(value), + true + ) + } + + vertexAttribPointer = function (index, size, type, normalized, stride, offset) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.vertexAttribPointer + ',' + index + ',' + size + ',' + type + ',' + Number(normalized) + ',' + stride + ',' + offset, + true + ) + } + + viewport = function (x, y, width, height) { + WebGLRenderingContext.GBridge.callNative( + this._canvas.id, + GLmethod.viewport + ',' + x + ',' + y + ',' + width + ',' + height, + true + ) + } +} \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/context-webgl/Shader.js b/components/firstui/fui-circle/gcanvas/context-webgl/Shader.js new file mode 100644 index 0000000..e43a9a7 --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/context-webgl/Shader.js @@ -0,0 +1,23 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 61 4 07 2 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLShader'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLShader { + className = name; + + constructor(id, type) { + this.id = id; + this.type = type; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/context-webgl/ShaderPrecisionFormat.js b/components/firstui/fui-circle/gcanvas/context-webgl/ShaderPrecisionFormat.js new file mode 100644 index 0000000..a3749c6 --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/context-webgl/ShaderPrecisionFormat.js @@ -0,0 +1,12 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 6 1 4072 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +export default class WebGLShaderPrecisionFormat { + className = 'WebGLShaderPrecisionFormat'; + + constructor({ + rangeMin, rangeMax, precision + }) { + this.rangeMin = rangeMin; + this.rangeMax = rangeMax; + this.precision = precision; + } +} \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/context-webgl/Texture.js b/components/firstui/fui-circle/gcanvas/context-webgl/Texture.js new file mode 100644 index 0000000..bfec0fb --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/context-webgl/Texture.js @@ -0,0 +1,23 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 186 1 4072 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLTexture'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLTexture { + className = name; + + constructor(id, type) { + this.id = id; + this.type = type; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/context-webgl/UniformLocation.js b/components/firstui/fui-circle/gcanvas/context-webgl/UniformLocation.js new file mode 100644 index 0000000..f21bf6d --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/context-webgl/UniformLocation.js @@ -0,0 +1,23 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1861 4 072 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import {getTransferedObjectUUID} from './classUtils'; + +const name = 'WebGLUniformLocation'; + +function uuid(id) { + return getTransferedObjectUUID(name, id); +} + +export default class WebGLUniformLocation { + className = name; + + constructor(id, type) { + this.id = id; + this.type = type; + } + + static uuid = uuid; + + uuid() { + return uuid(this.id); + } +} \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/context-webgl/classUtils.js b/components/firstui/fui-circle/gcanvas/context-webgl/classUtils.js new file mode 100644 index 0000000..a4ea485 --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/context-webgl/classUtils.js @@ -0,0 +1,4 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:186 1 4 072 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +export function getTransferedObjectUUID(name, id) { + return `${name.toLowerCase()}-${id}`; +} \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/env/canvas.js b/components/firstui/fui-circle/gcanvas/env/canvas.js new file mode 100644 index 0000000..3b4d835 --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/env/canvas.js @@ -0,0 +1,75 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 186 14 0725 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import GContext2D from '../context-2d/RenderingContext'; +import GContextWebGL from '../context-webgl/RenderingContext'; + +export default class GCanvas { + + // static GBridge = null; + + id = null; + + _needRender = true; + + constructor(id, { disableAutoSwap }) { + this.id = id; + + this._disableAutoSwap = disableAutoSwap; + if (disableAutoSwap) { + this._swapBuffers = () => { + GCanvas.GBridge.render(this.id); + } + } + } + + getContext(type) { + + let context = null; + + if (type.match(/webgl/i)) { + context = new GContextWebGL(this); + + context.componentId = this.id; + + if (!this._disableAutoSwap) { + const render = () => { + if (this._needRender) { + GCanvas.GBridge.render(this.id); + this._needRender = false; + } + } + setInterval(render, 16); + } + + GCanvas.GBridge.callSetContextType(this.id, 1); // 0 for 2d; 1 for webgl + } else if (type.match(/2d/i)) { + context = new GContext2D(this); + + context.componentId = this.id; + +// const render = ( callback ) => { +// +// const commands = context._drawCommands; +// context._drawCommands = ''; +// +// GCanvas.GBridge.render2d(this.id, commands, callback); +// this._needRender = false; +// } +// //draw方法触发 +// context._flush = render; +// //setInterval(render, 16); + + GCanvas.GBridge.callSetContextType(this.id, 0); + } else { + throw new Error('not supported context ' + type); + } + + return context; + + } + + reset() { + GCanvas.GBridge.callReset(this.id); + } + + +} \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/env/image.js b/components/firstui/fui-circle/gcanvas/env/image.js new file mode 100644 index 0000000..af4d13f --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/env/image.js @@ -0,0 +1,97 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 6 140 7 254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +let incId = 1; + +const noop = function () { }; + +class GImage { + + static GBridge = null; + + constructor() { + this._id = incId++; + this._width = 0; + this._height = 0; + this._src = undefined; + this._onload = noop; + this._onerror = noop; + this.complete = false; + } + + get width() { + return this._width; + } + set width(v) { + this._width = v; + } + + get height() { + return this._height; + } + + set height(v) { + this._height = v; + } + + get src() { + return this._src; + } + + set src(v) { + + if (v.startsWith('//')) { + v = 'http:' + v; + } + + this._src = v; + + GImage.GBridge.perloadImage([this._src, this._id], (data) => { + if (typeof data === 'string') { + data = JSON.parse(data); + } + if (data.error) { + var evt = { type: 'error', target: this }; + this.onerror(evt); + } else { + this.complete = true; + this.width = typeof data.width === 'number' ? data.width : 0; + this.height = typeof data.height === 'number' ? data.height : 0; + var evt = { type: 'load', target: this }; + this.onload(evt); + } + }); + } + + addEventListener(name, listener) { + if (name === 'load') { + this.onload = listener; + } else if (name === 'error') { + this.onerror = listener; + } + } + + removeEventListener(name, listener) { + if (name === 'load') { + this.onload = noop; + } else if (name === 'error') { + this.onerror = noop; + } + } + + get onload() { + return this._onload; + } + + set onload(v) { + this._onload = v; + } + + get onerror() { + return this._onerror; + } + + set onerror(v) { + this._onerror = v; + } +} + +export default GImage; \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/env/tool.js b/components/firstui/fui-circle/gcanvas/env/tool.js new file mode 100644 index 0000000..608bf71 --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/env/tool.js @@ -0,0 +1,25 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1861 4 07 254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 + +export function ArrayBufferToBase64 (buffer) { + var binary = ''; + var bytes = new Uint8ClampedArray(buffer); + for (var len = bytes.byteLength, i = 0; i < len; i++) { + binary += String.fromCharCode(bytes[i]); + } + return btoa(binary); +} + +export function Base64ToUint8ClampedArray(base64String) { + const padding = '='.repeat((4 - base64String.length % 4) % 4); + const base64 = (base64String + padding) + .replace(/\-/g, '+') + .replace(/_/g, '/'); + + const rawData = atob(base64); + const outputArray = new Uint8ClampedArray(rawData.length); + + for (let i = 0; i < rawData.length; ++i) { + outputArray[i] = rawData.charCodeAt(i); + } + return outputArray; +} \ No newline at end of file diff --git a/components/firstui/fui-circle/gcanvas/index.js b/components/firstui/fui-circle/gcanvas/index.js new file mode 100644 index 0000000..bc26df7 --- /dev/null +++ b/components/firstui/fui-circle/gcanvas/index.js @@ -0,0 +1,48 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 186140 72 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +import GCanvas from './env/canvas'; +import GImage from './env/image'; + +import GWebGLRenderingContext from './context-webgl/RenderingContext'; +import GContext2D from './context-2d/RenderingContext'; + +import GBridgeWeex from './bridge/bridge-weex'; + +export let Image = GImage; + +export let WeexBridge = GBridgeWeex; + +export function enable(el, { + bridge, + debug, + disableAutoSwap, + disableComboCommands +} = {}) { + + const GBridge = GImage.GBridge = GCanvas.GBridge = GWebGLRenderingContext.GBridge = GContext2D.GBridge = bridge; + + GBridge.callEnable(el.ref, [ + 0, // renderMode: 0--RENDERMODE_WHEN_DIRTY, 1--RENDERMODE_CONTINUOUSLY + -1, // hybridLayerType: 0--LAYER_TYPE_NONE 1--LAYER_TYPE_SOFTWARE 2--LAYER_TYPE_HARDWARE + false, // supportScroll + false, // newCanvasMode + 1, // compatible + 'white', // clearColor + false // sameLevel: newCanvasMode = true && true => GCanvasView and Webview is same level + ]); + + if (debug === true) { + GBridge.callEnableDebug(); + } + if (disableComboCommands) { + GBridge.callEnableDisableCombo(); + } + + var canvas = new GCanvas(el.ref, { + disableAutoSwap + }); + let pixelRatio = uni.getSystemInfoSync().pixelRatio; + canvas.width = el.style.width * pixelRatio; + canvas.height = el.style.height * pixelRatio; + + return canvas; +}; \ No newline at end of file diff --git a/components/firstui/fui-circle/mpjs.js b/components/firstui/fui-circle/mpjs.js new file mode 100644 index 0000000..856f31e --- /dev/null +++ b/components/firstui/fui-circle/mpjs.js @@ -0,0 +1,142 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1 86 14072 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +// #ifdef MP + +export default { + data() { + return { + context: null, + start: 0 + } + }, + watch: { + percent(val) { + setTimeout(() => { + this.init(); + }, 50) + }, + w(val) { + setTimeout(() => { + this.init(); + }, 50) + }, + strokeWidth(val) { + setTimeout(() => { + this.init(); + }, 50) + } + }, + mounted() { + this.$nextTick(() => { + setTimeout(() => { + this.init(); + }, 50) + }) + }, + methods: { + //初始化绘制 + init(init) { + let start = this.activeMode === 'backwards' ? 0 : this.start; + start = start > this.percent ? 0 : start; + this.drawCircle(start); + }, + //默认背景 + drawDefaultCircle(ctx) { + let sw = Number(this.strokeWidth); + // #ifdef MP-ALIPAY + sw = sw * 4 + // #endif + ctx.setLineWidth(sw); + ctx.setStrokeStyle(this.background); + let eAngle = Math.PI * 2 + Number(this.sAngle) * Math.PI; + this.drawArc(ctx, eAngle, true); + }, + drawCircle(start) { + let ctx = this.context; + if (!ctx) { + ctx = uni.createCanvasContext(this.circleId, this); + this.context = ctx; + } + //绘制默认背景 + this.defaultShow && this.drawDefaultCircle(ctx) + let sw = Number(this.strokeWidth) + // #ifdef MP-ALIPAY + sw = sw * 4 + // #endif + ctx.setLineWidth(sw); + let gradient = this.foreground || this.primaryColor; + // #ifndef MP-KUAISHOU + if (this.gradient) { + gradient = ctx.createLinearGradient(0, 0, Number(this.w), 0); + gradient.addColorStop(0, this.gradient); + gradient.addColorStop(1, this.foreground || this.primaryColor); + } + // #endif + ctx.setStrokeStyle(gradient); + let percentage = Number(this.percent) + if (percentage > 0) { + start += Number(this.speed); + start = start > percentage ? percentage : start; + } + if (this.show) { + let si = Number(this.size) + // #ifdef MP-ALIPAY + si = si * 4 + // #endif + ctx.setFontSize(si); + ctx.setFillStyle(this.color || this.primaryColor); + ctx.setTextAlign('center'); + ctx.setTextBaseline('middle'); + let percent = `${this.counterclockwise ? 100 - start : start}%`; + let radius = this.w / 2 + // #ifdef MP-ALIPAY + radius = radius * 4 + // #endif + ctx.fillText(percent, radius, radius); + } + if (percentage == 0 || (this.counterclockwise && start == 100)) { + ctx.draw(); + } else { + let eAngle = ((2 * Math.PI) / 100) * start + Number(this.sAngle) * Math.PI; + this.drawArc(ctx, eAngle); + } + let time = 1000 / 60 + // #ifdef MP-ALIPAY + time = time / 2 + // #endif + setTimeout(() => { + this.start = start; + if (start == percentage) { + this.$emit('end', { + canvasId: this.circleId, + percent: start + }); + } else { + this.drawCircle(start); + } + this.$emit('change', { + percent: start + }); + }, time); + }, + //创建弧线 + drawArc(ctx, eAngle, def) { + ctx.setLineCap(this.lineCap); + ctx.beginPath(); + let radius = this.w / 2; + let sw = Number(this.strokeWidth); + // #ifdef MP-ALIPAY + radius = radius * 4 + sw = sw * 4 + // #endif + ctx.arc(radius, radius, radius - sw, Number(this.sAngle) * Math.PI, eAngle, this.counterclockwise); + ctx.stroke(); + !def && ctx.draw(); + } + } +} + +// #endif + +// #ifndef MP +export default {} +// #endif \ No newline at end of file diff --git a/components/firstui/fui-circle/nvue.js b/components/firstui/fui-circle/nvue.js new file mode 100644 index 0000000..81cf289 --- /dev/null +++ b/components/firstui/fui-circle/nvue.js @@ -0,0 +1,142 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18614072 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +// #ifdef APP-NVUE +import { + enable, + WeexBridge +} from './gcanvas/index.js'; +export default { + data() { + return { + start: 0 + } + }, + watch: { + percent(val) { + setTimeout(() => { + this.init(); + }, 50) + }, + w(val) { + setTimeout(() => { + this.init(); + }, 50) + }, + strokeWidth(val) { + setTimeout(() => { + this.init(); + }, 50) + } + }, + created() { + let sys = uni.getSystemInfoSync() + this.isAndroid = sys.platform.toLocaleLowerCase() == "android" + this.fontSize = this.isAndroid ? Number(this.size) : Number(this.size) * sys.pixelRatio + }, + mounted() { + setTimeout(() => { + this.init(true); + }, 50); + }, + // #ifndef VUE3 + beforeDestroy() { + this.context = null; + }, + // #endif + // #ifdef VUE3 + beforeUnmount() { + this.context = null; + }, + // #endif + methods: { + //初始化绘制 + init(init) { + let start = this.activeMode === 'backwards' ? 0 : this.start; + this.drawCircle(start); + }, + //默认背景 + drawDefaultCircle(ctx) { + ctx.setLineWidth(Number(this.strokeWidth)); + ctx.setStrokeStyle(this.background); + let eAngle = Math.PI * 2 + Number(this.sAngle) * Math.PI; + this.drawArc(ctx, eAngle, true); + }, + //进度圆环 + drawCircle(start) { + let ctx = this.context; + if (!ctx) { + let ganvas = this.$refs[this.circleId]; + let canvas = enable(ganvas, { + bridge: WeexBridge + }); + ctx = canvas.getContext('2d'); + //android赋值后,canvas大小可能不受控制 + this.context = ctx; + } + //绘制默认背景 + if (!this.isAndroid) { + ctx.setFillStyle(this.fillStyle) + ctx.fillRect(0, 0, this.w, this.w) + } + // ctx.clearRect(0, 0, this.w, this.w) + this.defaultShow && this.drawDefaultCircle(ctx) + ctx.setLineWidth(Number(this.strokeWidth)); + ctx.beginPath() + let gradient = this.foreground || this.primaryColor; + // if (this.gradient) { + // gradient = ctx.createLinearGradient(0, 0, this.w, 0); + // gradient.addColorStop(0, this.gradient); + // gradient.addColorStop(1, this.foreground); + // } + ctx.setStrokeStyle(gradient); + let percentage = Number(this.percent) + if (percentage > 0) { + start += Number(this.speed); + start = start > percentage ? percentage : start; + } + if (this.show) { + ctx.setFontSize(this.fontSize); + ctx.setFillStyle(this.color || this.primaryColor); + ctx.setTextAlign('center'); + ctx.setTextBaseline('middle'); + let percent = `${this.counterclockwise ? 100 - start : start}%`; + let radius = this.w / 2; + ctx.fillText(percent, radius, radius); + } + if (percentage == 0 || (this.counterclockwise && start == 100)) { + ctx.draw(); + } else { + let eAngle = ((2 * Math.PI) / 100) * start + Number(this.sAngle) * Math.PI; + this.drawArc(ctx, eAngle); + } + setTimeout(() => { + this.start = start; + if (start == percentage) { + this.$emit('end', { + canvasId: this.circleId, + percent: start + }); + } else { + this.drawCircle(start); + } + this.$emit('change', { + percent: start + }); + }, 1000 / 60); + }, + drawArc(ctx, eAngle, def) { + ctx.setLineCap(this.lineCap); + ctx.beginPath(); + let radius = this.w / 2; + ctx.arc(radius, radius, radius - Number(this.strokeWidth), Number(this.sAngle) * Math.PI, eAngle, this + .counterclockwise); + ctx.stroke(); + !def && ctx.draw(); + } + } +} + +// #endif + +// #ifndef APP-NVUE +export default {} +// #endif \ No newline at end of file diff --git a/components/firstui/fui-circle/render.js b/components/firstui/fui-circle/render.js new file mode 100644 index 0000000..61b8660 --- /dev/null +++ b/components/firstui/fui-circle/render.js @@ -0,0 +1,31 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18614 0725 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +// #ifdef APP-VUE || H5 +export default { + data() { + return { + percentage: -1 + } + }, + watch: { + percent(val) { + this.percentage = Number(val) || 0 + } + }, + mounted() { + this.percentage = Number(this.percent) || 0 + }, + methods: { + change(e) { + this.$emit('change', e); + }, + end(e) { + this.$emit('end', e); + } + } +} + +// #endif + +// #ifndef APP-VUE || H5 +export default {} +// #endif \ No newline at end of file diff --git a/components/firstui/fui-clipboard/clipboard.min.js b/components/firstui/fui-clipboard/clipboard.min.js new file mode 100644 index 0000000..91acce0 --- /dev/null +++ b/components/firstui/fui-clipboard/clipboard.min.js @@ -0,0 +1,8 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 6 1 4 0 7254 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +// #ifdef H5 +/** + * clipboard.min.js support for ES6 module import + * https://doc.firstui.cn/ + **/ +function select(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var i=t.hasAttribute("readonly");i||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),i||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var n=window.getSelection(),r=document.createRange();r.selectNodeContents(t),n.removeAllRanges(),n.addRange(r),e=n.toString()}return e}class ClipboardAction{constructor(t){this.resolveOptions(t),this.initSelection()}resolveOptions(t={}){this.action=t.action,this.container=t.container,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}initSelection(){this.text?this.selectFake():this.target&&this.selectTarget()}selectFake(){const t="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=(()=>this.removeFake()),this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[t?"right":"left"]="-9999px";let e=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=`${e}px`,this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=select(this.fakeElem),this.copyText()}removeFake(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}selectTarget(){this.selectedText=select(this.target),this.copyText()}copyText(){let t;try{t=document.execCommand(this.action)}catch(e){t=!1}this.handleResult(t)}handleResult(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}clearSelection(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}set action(t="copy"){if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')}get action(){return this._action}set target(t){if(void 0!==t){if(!t||"object"!=typeof t||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}}get target(){return this._target}destroy(){this.removeFake()}}function Emitter(){}Emitter.prototype={on:function(t,e,i){var n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:e,ctx:i}),this},once:function(t,e,i){var n=this;function r(){n.off(t,r),e.apply(i,arguments)}return r._=e,this.on(t,r,i)},emit:function(t){for(var e=[].slice.call(arguments,1),i=((this.e||(this.e={}))[t]||[]).slice(),n=0,r=i.length;nthis.onClick(t))}onClick(t){const e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new ClipboardAction({action:this.action(e),target:this.target(e),text:this.text(e),container:this.container,trigger:e,emitter:this})}defaultAction(t){return getAttributeValue("action",t)}defaultTarget(t){const e=getAttributeValue("target",t);if(e)return document.querySelector(e)}static isSupported(t=["copy","cut"]){const e="string"==typeof t?[t]:t;let i=!!document.queryCommandSupported;return e.forEach(t=>{i=i&&!!document.queryCommandSupported(t)}),i}defaultText(t){return getAttributeValue("text",t)}destroy(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}function getAttributeValue(t,e){const i=`data-clipboard-${t}`;if(e.hasAttribute(i))return e.getAttribute(i)}export default Clipboard; +// #endif \ No newline at end of file diff --git a/components/firstui/fui-clipboard/index.js b/components/firstui/fui-clipboard/index.js new file mode 100644 index 0000000..9ee85fa --- /dev/null +++ b/components/firstui/fui-clipboard/index.js @@ -0,0 +1,52 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 6 14 0 725 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +/*! + * 剪贴板 + * + * 官网地址:https://firstui.cn/ + * 文档地址:https://doc.firstui.cn/ + */ +// #ifdef H5 +import ClipboardJS from "./clipboard.min.js" +// #endif + +/** + * data 需要复制的数据 + * callback 回调 + * e 当用户点击后需要先请求接口再进行复制时,需要传入此参数(H5端) + * **/ +const getClipboardData = function(data, callback, e) { + // #ifdef APP-PLUS || MP + uni.setClipboardData({ + data: data, + success(res) { + ("function" == typeof callback) && callback(true) + }, + fail(res) { + ("function" == typeof callback) && callback(false) + } + }) + // #endif + + // #ifdef H5 + let event =window.event || e || {} + let clipboard = new ClipboardJS("", { + text: () => data + }) + clipboard.on('success', (e) => { + ("function" == typeof callback) && callback(true) + clipboard.off('success') + clipboard.off('error') + clipboard.destroy() + }); + clipboard.on('error', (e) => { + ("function" == typeof callback) && callback(false) + clipboard.off('success') + clipboard.off('error') + clipboard.destroy() + }); + clipboard.onClick(event) + // #endif +} +export default { + getClipboardData: getClipboardData +}; \ No newline at end of file diff --git a/components/firstui/fui-col/fui-col.vue b/components/firstui/fui-col/fui-col.vue new file mode 100644 index 0000000..4e07737 --- /dev/null +++ b/components/firstui/fui-col/fui-col.vue @@ -0,0 +1,3220 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-collapse-item/fui-collapse-item.vue b/components/firstui/fui-collapse-item/fui-collapse-item.vue new file mode 100644 index 0000000..a6cce82 --- /dev/null +++ b/components/firstui/fui-collapse-item/fui-collapse-item.vue @@ -0,0 +1,351 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-collapse/fui-collapse.vue b/components/firstui/fui-collapse/fui-collapse.vue new file mode 100644 index 0000000..6f91276 --- /dev/null +++ b/components/firstui/fui-collapse/fui-collapse.vue @@ -0,0 +1,50 @@ + + + + \ No newline at end of file diff --git a/components/firstui/fui-config/index.js b/components/firstui/fui-config/index.js new file mode 100644 index 0000000..26385db --- /dev/null +++ b/components/firstui/fui-config/index.js @@ -0,0 +1,115 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 86 1 40 72 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +/* + 组件属性全局配置文件。优先级:全局配置文件props < 直接设置组件props + 目前支持配置的组件:fui-button、fui-icon、fui-text、fui-input、fui-form-item、fui-list-cell +*/ + +// 主色(V1.9.8+),仅Nvue端以及无法使用css变量控制颜色的组件使用【保持与fui-theme中一致】 +const color = { + primary: '#465CFF', + success: '#09BE4F', + warning: '#FFB703', + danger: '#FF2B2B', + purple: '#6831FF', + link: '#465CFF' +} + +//全局方法(V1.9.8+) +const app = { + toast: function(text, icon = 'none') { + text && uni.showToast({ + title: text, + icon: icon, + duration: 2000 + }) + }, + modal: function(title, content, callback, showCancel, confirmColor, confirmText) { + uni.showModal({ + title: title, + content: content, + showCancel: showCancel || false, + // #ifndef MP-TOUTIAO + cancelColor: "#7F7F7F", + confirmColor: confirmColor || color.primary, + // #endif + confirmText: confirmText || "确定", + success(res) { + if (res.confirm) { + callback && callback(true) + } else { + callback && callback(false) + } + }, + fail(err) { + console.log(err) + } + }) + }, + href(url, isMain) { + if (isMain) { + uni.switchTab({ + url: url + }) + } else { + uni.navigateTo({ + url: url + }); + } + } +} + +const fuiConfig = { + //组件名称,小驼峰命名 + //如fui-button写成fuiButton + fuiButton: { + //组件属性值 + height: '96rpx', + size: 32, + radius: '16rpx' + }, + fuiIcon: { + size: 64, + unit: 'rpx', + //V1.9.8+ + color: '' + }, + fuiText: { + size: 32, + unit: 'rpx', + //仅Nvue有效,black 默认颜色,V1.9.8+ + color: '' + }, + fuiInput: { + labelSize: 32, + size: 32 + }, + fuiFormItem: { + labelSize: 32, + labelWidth: 164, + labelRight: 30, + labelWeight: 400, + labelAlign: 'left', + asteriskPosition: 'left' + }, + // V1.9.8+ + fuiListCell: { + padding: ['32rpx', '32rpx'], + arrowColor: '', + //仅Nvue有效 + borderColor: '', + bottomLeft: 32 + }, + // V1.9.9+ + fuiSection: { + size: 32, + color: '#181818', + fontWeight: 600, + descrSize: 28, + descrColor: '#B2B2B2', + descrTop: 12 + }, + color, + ...app +} + +export default fuiConfig \ No newline at end of file diff --git a/components/firstui/fui-copy-text/fui-copy-text.vue b/components/firstui/fui-copy-text/fui-copy-text.vue new file mode 100644 index 0000000..96fd5fc --- /dev/null +++ b/components/firstui/fui-copy-text/fui-copy-text.vue @@ -0,0 +1,465 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-copy-text/lib/clipboard.min.js b/components/firstui/fui-copy-text/lib/clipboard.min.js new file mode 100644 index 0000000..55b64b6 --- /dev/null +++ b/components/firstui/fui-copy-text/lib/clipboard.min.js @@ -0,0 +1,8 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18614 0 725 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +// #ifdef H5 +/** + * clipboard.min.js support for ES6 module import + * https://doc.firstui.cn/ + **/ +function select(t){var e;if("SELECT"===t.nodeName)t.focus(),e=t.value;else if("INPUT"===t.nodeName||"TEXTAREA"===t.nodeName){var i=t.hasAttribute("readonly");i||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),i||t.removeAttribute("readonly"),e=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var n=window.getSelection(),r=document.createRange();r.selectNodeContents(t),n.removeAllRanges(),n.addRange(r),e=n.toString()}return e}class ClipboardAction{constructor(t){this.resolveOptions(t),this.initSelection()}resolveOptions(t={}){this.action=t.action,this.container=t.container,this.emitter=t.emitter,this.target=t.target,this.text=t.text,this.trigger=t.trigger,this.selectedText=""}initSelection(){this.text?this.selectFake():this.target&&this.selectTarget()}selectFake(){const t="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=(()=>this.removeFake()),this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[t?"right":"left"]="-9999px";let e=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=`${e}px`,this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=select(this.fakeElem),this.copyText()}removeFake(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}selectTarget(){this.selectedText=select(this.target),this.copyText()}copyText(){let t;try{t=document.execCommand(this.action)}catch(e){t=!1}this.handleResult(t)}handleResult(t){this.emitter.emit(t?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}clearSelection(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}set action(t="copy"){if(this._action=t,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')}get action(){return this._action}set target(t){if(void 0!==t){if(!t||"object"!=typeof t||1!==t.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&t.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(t.hasAttribute("readonly")||t.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=t}}get target(){return this._target}destroy(){this.removeFake()}}function Emitter(){}Emitter.prototype={on:function(t,e,i){var n=this.e||(this.e={});return(n[t]||(n[t]=[])).push({fn:e,ctx:i}),this},once:function(t,e,i){var n=this;function r(){n.off(t,r),e.apply(i,arguments)}return r._=e,this.on(t,r,i)},emit:function(t){for(var e=[].slice.call(arguments,1),i=((this.e||(this.e={}))[t]||[]).slice(),n=0,r=i.length;nthis.onClick(t))}onClick(t){const e=t.delegateTarget||t.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new ClipboardAction({action:this.action(e),target:this.target(e),text:this.text(e),container:this.container,trigger:e,emitter:this})}defaultAction(t){return getAttributeValue("action",t)}defaultTarget(t){const e=getAttributeValue("target",t);if(e)return document.querySelector(e)}static isSupported(t=["copy","cut"]){const e="string"==typeof t?[t]:t;let i=!!document.queryCommandSupported;return e.forEach(t=>{i=i&&!!document.queryCommandSupported(t)}),i}defaultText(t){return getAttributeValue("text",t)}destroy(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}function getAttributeValue(t,e){const i=`data-clipboard-${t}`;if(e.hasAttribute(i))return e.getAttribute(i)}export default Clipboard; +// #endif \ No newline at end of file diff --git a/components/firstui/fui-copy-text/lib/index.js b/components/firstui/fui-copy-text/lib/index.js new file mode 100644 index 0000000..b990487 --- /dev/null +++ b/components/firstui/fui-copy-text/lib/index.js @@ -0,0 +1,52 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 1861 4 0 7 2 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +/*! + * 剪贴板 + * + * 官网地址:https://firstui.cn/ + * 文档地址:https://doc.firstui.cn/ + */ +// #ifdef H5 +import ClipboardJS from "./clipboard.min.js" +// #endif + +/** + * data 需要复制的数据 + * callback 回调 + * e 当用户点击后需要先请求接口再进行复制时,需要传入此参数(H5端) + * **/ +const getClipboardData = function(data, callback, e) { + // #ifdef APP-PLUS || MP + uni.setClipboardData({ + data: data, + success(res) { + ("function" == typeof callback) && callback(true) + }, + fail(res) { + ("function" == typeof callback) && callback(false) + } + }) + // #endif + + // #ifdef H5 + let event = window.event || e || {} + let clipboard = new ClipboardJS("", { + text: () => data + }) + clipboard.on('success', (e) => { + ("function" == typeof callback) && callback(true) + clipboard.off('success') + clipboard.off('error') + clipboard.destroy() + }); + clipboard.on('error', (e) => { + ("function" == typeof callback) && callback(false) + clipboard.off('success') + clipboard.off('error') + clipboard.destroy() + }); + clipboard.onClick(event) + // #endif +} +export default { + getClipboardData: getClipboardData +}; \ No newline at end of file diff --git a/components/firstui/fui-count-down/fui-count-down.vue b/components/firstui/fui-count-down/fui-count-down.vue new file mode 100644 index 0000000..12de836 --- /dev/null +++ b/components/firstui/fui-count-down/fui-count-down.vue @@ -0,0 +1,376 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-countdown-verify/fui-countdown-verify.vue b/components/firstui/fui-countdown-verify/fui-countdown-verify.vue new file mode 100644 index 0000000..df29831 --- /dev/null +++ b/components/firstui/fui-countdown-verify/fui-countdown-verify.vue @@ -0,0 +1,264 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-cubic-bezier/fui-cubic-bezier.vue b/components/firstui/fui-cubic-bezier/fui-cubic-bezier.vue new file mode 100644 index 0000000..a88df9d --- /dev/null +++ b/components/firstui/fui-cubic-bezier/fui-cubic-bezier.vue @@ -0,0 +1,225 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-data-tag/fui-data-tag.vue b/components/firstui/fui-data-tag/fui-data-tag.vue new file mode 100644 index 0000000..32af25e --- /dev/null +++ b/components/firstui/fui-data-tag/fui-data-tag.vue @@ -0,0 +1,436 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-date-picker/fui-date-picker.vue b/components/firstui/fui-date-picker/fui-date-picker.vue new file mode 100644 index 0000000..6d994e6 --- /dev/null +++ b/components/firstui/fui-date-picker/fui-date-picker.vue @@ -0,0 +1,1445 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-dialog/fui-dialog.vue b/components/firstui/fui-dialog/fui-dialog.vue new file mode 100644 index 0000000..ced954f --- /dev/null +++ b/components/firstui/fui-dialog/fui-dialog.vue @@ -0,0 +1,306 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-digital-keyboard/fui-digital-keyboard.vue b/components/firstui/fui-digital-keyboard/fui-digital-keyboard.vue new file mode 100644 index 0000000..620df45 --- /dev/null +++ b/components/firstui/fui-digital-keyboard/fui-digital-keyboard.vue @@ -0,0 +1,497 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-digital-roller/fui-digital-roller.vue b/components/firstui/fui-digital-roller/fui-digital-roller.vue new file mode 100644 index 0000000..f29eb33 --- /dev/null +++ b/components/firstui/fui-digital-roller/fui-digital-roller.vue @@ -0,0 +1,188 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-divider/fui-divider.vue b/components/firstui/fui-divider/fui-divider.vue new file mode 100644 index 0000000..394a7c4 --- /dev/null +++ b/components/firstui/fui-divider/fui-divider.vue @@ -0,0 +1,112 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-drag/bindingx.js b/components/firstui/fui-drag/bindingx.js new file mode 100644 index 0000000..8b48b98 --- /dev/null +++ b/components/firstui/fui-drag/bindingx.js @@ -0,0 +1,201 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 614 07 2 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +// #ifdef APP-NVUE +const animation = uni.requireNativePlugin('animation'); +export default { + watch: { + list(vals) { + this.$nextTick(() => { + setTimeout(() => { + this.getRefs(vals) + }, 50) + }) + } + }, + data() { + return { + current: -1, + startTouch: null, + tDragging: false, + sId: null, + preStartKey: null, + isAndroid: false, + divisor: 1/2 + } + }, + created() { + const res = uni.getSystemInfoSync(); + this.isAndroid = res.platform.toLocaleLowerCase() == "android" + this.divisor = this.isAndroid ? 5/4 : 1/2 + this.allRefs = [] + }, + methods: { + getEl(el) { + return el.ref || el[0].ref; + }, + getRefs(vals) { + this.allRefs = [] + if (!vals || vals.length === 0) return; + vals.forEach((item, index) => { + let ref = this.getEl(this.$refs[`f_drag_${index}`]) + this.allRefs.push(ref) + this._animation(ref, index, item.transX, item.transY) + }) + }, + _animation(ref, index, x, y) { + animation.transition(ref, { + styles: { + transform: `translate(${x},${y})` + }, + duration: this.current === index ? 0 : 250, + timingFunction: 'linear', + needLayout: false, + delay: 0 + }); + }, + outOfRange(x1, y1, x2, y2, x3, y3) { + return x1 < 0 || x1 >= y1 || x2 < 0 || x2 >= y2 || x3 < 0 || x3 >= y3 + }, + listSort(sKey, eKey) { + let endRealKey = -1; + this.list.forEach((item) => { + if (item.sortKey === eKey) endRealKey = item.realKey; + }); + + return this.list.map((item) => { + let cKey = item.sortKey; + let rKey = item.realKey; + if (sKey < eKey) { + if (cKey > sKey && cKey <= eKey) { + --rKey; + --cKey; + } else if (cKey === sKey) { + rKey = endRealKey; + cKey = eKey; + } + } else if (sKey > eKey) { + if (cKey >= eKey && cKey < sKey) { + ++rKey; + ++cKey; + } else if (cKey === sKey) { + rKey = endRealKey; + cKey = eKey; + } + } + if (item.sortKey !== cKey) { + let columns = Number(this.columns) + item.transX = (cKey % columns) * this.cellWidth + "px"; + item.transY = Math.floor(cKey / columns) * this.cellHeight + "px"; + item.sortKey = cKey; + item.realKey = rKey; + } + return item; + }); + }, + emitsEvent(list, type) { + let changeList = [], + itemList = []; + + list.forEach((item) => { + changeList[item.sortKey] = item; + }); + + changeList.forEach((item) => { + itemList.push(item.entity); + }); + if (type == "change") { + this.change({ + itemList: itemList + }); + } else { + this.sortend({ + itemList: itemList + }); + } + }, + getXY(touch) { + if (this.isAndroid) { + touch.pageX = touch.screenX + touch.pageY = touch.screenY + } + return touch + }, + longPress(e) { + if (!this.isDrag) return; + let touch = e.changedTouches && e.changedTouches[0] ? e.changedTouches[0] : this.startTouch; + if (!touch) return; + this.current = Number(e.currentTarget.dataset.index); + if (this.tDragging) return; + let ref = this.allRefs[this.current] + if (!ref) return; + touch = this.getXY(touch) + let transX = this.columns == 1 ? 0 : touch.pageX - (this.cellWidth / 2 + this.wrapLeft) + 'px'; + // this.initY = touch.pageY - (this.wrapTop + this.cellHeight * (Math.ceil(this.current / this.columns))) + let transY = touch.pageY - (this.cellHeight * this.divisor + this.wrapTop ) + 'px'; + this._animation(ref, this.current, transX, transY) + this.sId = touch.identifier; + this.tDragging = true; + }, + touchstart(e) { + if (!this.isDrag) return; + this.startTouch = e.changedTouches[0] || e.touches[0]; + }, + touchmove(e) { + if (!this.isDrag || !this.tDragging) return; + let touch = e.changedTouches[0] || e.touches[0]; + // || this.sId !== touch.identifier + if (!touch) return; + touch = this.getXY(touch) + let transX = this.columns == 1 ? 0 : touch.pageX - (this.cellWidth / 2 + this.wrapLeft); + let transY = touch.pageY - (this.cellHeight * this.divisor + this.wrapTop); + if (touch.pageY > this.windowHeight - this.cellHeight) { + this.pageScroll({ + scrollTop: touch.pageY + this.cellHeight - this.windowHeight + }) + } else if (touch.pageY < this.cellHeight) { + this.pageScroll({ + scrollTop: touch.pageY - this.cellHeight + }) + } + let ref = this.allRefs[this.current] + if (!ref) return; + this._animation(ref, this.current, transX + 'px', transY + 'px') + let startKey = this.list[this.current].sortKey; + let curX = Math.round(transX / this.cellWidth); + let curY = Math.round(transY / this.cellHeight); + let endKey = curX + Number(this.columns) * curY; + + if (this.outOfRange(curX, Number(this.columns), curY, this.rows, endKey, this.list.length)) return; + if (startKey === endKey || startKey === this.preStartKey) return; + this.preStartKey = startKey; + let list = this.listSort(startKey, endKey); + this.allRefs.forEach((ins, index) => { + var item = list[index]; + if (index !== this.current) { + this._animation(ins, index, item.transX, item.transY) + } + }); + this.listChange({ + itemList: list + }) + this.emitsEvent(list, "change"); + }, + touchend(e) { + if (!this.isDrag || !this.tDragging) return; + this.emitsEvent(this.list, "sortend"); + let cur = this.current + this.current = -1; + let ref = this.allRefs[cur] + if (!ref) return + this._animation(ref, cur, this.list[cur].transX, this.list[cur].transY) + this.preStartKey = -1; + this.tDragging = false; + + } + } +} + +// #endif + +// #ifndef APP-NVUE +export default {} +// #endif \ No newline at end of file diff --git a/components/firstui/fui-drag/f-drag-item.vue b/components/firstui/fui-drag/f-drag-item.vue new file mode 100644 index 0000000..edba0b9 --- /dev/null +++ b/components/firstui/fui-drag/f-drag-item.vue @@ -0,0 +1,209 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-drag/fui-drag.vue b/components/firstui/fui-drag/fui-drag.vue new file mode 100644 index 0000000..e300385 --- /dev/null +++ b/components/firstui/fui-drag/fui-drag.vue @@ -0,0 +1,373 @@ + + + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-drag/index.wxs b/components/firstui/fui-drag/index.wxs new file mode 100644 index 0000000..e1be0b6 --- /dev/null +++ b/components/firstui/fui-drag/index.wxs @@ -0,0 +1,290 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 6 14 0725 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +var wrapParam = {} + +function isPC() { + if (typeof navigator !== 'object') return false; + var userAgentInfo = navigator.userAgent; + var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; + var flag = true; + for (var v = 0; v < Agents.length - 1; v++) { + if (userAgentInfo.indexOf(Agents[v]) > 0) { + flag = false; + break; + } + } + return flag; +} +var isH5 = false +if (typeof window === 'object') isH5 = true + +function outOfRange(x1, y1, x2, y2, x3, y3) { + return x1 < 0 || x1 >= y1 || x2 < 0 || x2 >= y2 || x3 < 0 || x3 >= y3 +}; + +function listSort(sKey, eKey, st) { + var param = st.param + var endRealKey = -1; + st.list.forEach(function(item) { + if (item.sortKey === eKey) endRealKey = item.realKey; + }); + + return st.list.map(function(item) { + var cKey = item.sortKey; + var rKey = item.realKey; + if (sKey < eKey) { + if (cKey > sKey && cKey <= eKey) { + --rKey; + --cKey; + } else if (cKey === sKey) { + rKey = endRealKey; + cKey = eKey; + } + } else if (sKey > eKey) { + if (cKey >= eKey && cKey < sKey) { + ++rKey; + ++cKey; + } else if (cKey === sKey) { + rKey = endRealKey; + cKey = eKey; + } + } + if (item.sortKey !== cKey) { + item.transX = (cKey % param.columns) * param.cellWidth + "px"; + item.transY = Math.floor(cKey / param.columns) * param.cellHeight + "px"; + item.sortKey = cKey; + item.realKey = rKey; + } + return item; + }); +} + +function emitsEvent(list, type, ins) { + if (!ins) return; + var changeList = [], + itemList = []; + + list.forEach(function(item) { + changeList[item.sortKey] = item; + }); + + changeList.forEach(function(item) { + itemList.push(item.entity); + }); + if (type == "change") { + ins.callMethod("change", { + itemList: itemList + }); + } else { + ins.callMethod("sortend", { + itemList: itemList + }); + } +} + +function longPress(e, ownerInstance) { + var ins = e.instance; + var dataset = ins.getDataset() + var st = ins.getState(); + st.isDrag = +dataset.isdrag == 1 ? true : false + if (!st.isDrag) return; + + if (!st.param || st.param == 'undefined') { + st.param = JSON.parse(dataset.param) + } + var param = st.param; + var touch = null + if (isH5 && isPC()) { + touch = e; + } else { + touch = e.changedTouches ? e.changedTouches[0] : st.startTouch + } + if (!touch) return; + st.cur = +dataset.index; + + if (st.dragging) return; + // #ifdef MP-WEIXIN + ownerInstance.callMethod("drag", { + wxdrag: true + }); + // #endif + st.transX = param.columns === 1 ? 0 : touch.pageX - (param.cellWidth / 2 + param.wrapLeft); + st.transY = touch.pageY - (param.cellHeight / 2 + param.wrapTop); + st.sId = touch.identifier; + st.prevIns && st.prevIns.removeClass("fui-drag__trans-end") + ins.setStyle({ + 'transform': 'translate3d(' + st.transX + 'px, ' + st.transY + 'px, 0)' + }); + st.itemsInstance.forEach(function(item, index) { + item.removeClass("fui-drag__cur").removeClass("fui-drag__trans") + item.addClass(index === st.cur ? "fui-drag__cur" : "fui-drag__trans"); + }) + st.dragging = true; +} + +function touchStart(e, ownerInstance) { + var ins = e.instance; + var st = ins.getState() + st.list = wrapParam.list + st.itemsInstance = wrapParam.itemsInstance + st.param = wrapParam.param + if (isH5 && isPC()) { + st.startTouch = e; + } else { + st.startTouch = e.changedTouches[0] || e.touches[0] + } + var dataset = ins.getDataset() + st.isDrag = +dataset.isdrag == 1 ? true : false + // #ifdef MP-WEIXIN + ownerInstance.callMethod("drag", { + wxdrag: false + }); + // #endif +} + +function touchMove(e, ownerInstance, event) { + var st = {} + var touch = null + var ins = null + if (isH5 && isPC()) { + touch = e; + st = event.instance.getState() + ins = event.instance; + } else { + touch = e.changedTouches[0] || e.touches[0] + st = e.instance.getState() + ins = e.instance + } + if (e.preventDefault && st.dragging) { + e.preventDefault() + } + var param = st.param; + + if (!st.dragging || !st.isDrag) return; + if (!touch || st.sId !== touch.identifier) return; + + var transX = param.columns === 1 ? 0 : touch.pageX - (param.cellWidth / 2 + param.wrapLeft); + var transY = touch.pageY - (param.cellHeight / 2 + param.wrapTop); + + if (touch.clientY > param.windowHeight - param.cellHeight) { + ownerInstance.callMethod("pageScroll", { + scrollTop: touch.pageY + param.cellHeight - param.windowHeight + }); + } else if (touch.clientY < param.cellHeight) { + ownerInstance.callMethod("pageScroll", { + scrollTop: touch.pageY - param.cellHeight + }); + } + + ins.setStyle({ + 'transform': 'translate3d(' + transX + 'px, ' + transY + 'px, 0)' + }) + + var startKey = st.list[st.cur].sortKey; + var curX = Math.round(transX / param.cellWidth); + var curY = Math.round(transY / param.cellHeight); + var endKey = curX + param.columns * curY; + + if (outOfRange(curX, param.columns, curY, param.rows, endKey, st.list.length)) return; + + if (startKey === endKey || startKey === st.preStartKey) return; + st.preStartKey = startKey; + + var list = listSort(startKey, endKey, st); + st.itemsInstance.forEach(function(itemIns, index) { + var item = list[index]; + if (index !== st.cur) { + itemIns.setStyle({ + 'transform': 'translate3d(' + item.transX + ',' + item.transY + ', 0)' + }); + } + }); + ownerInstance.callMethod("listChange", { + itemList: list + }); + emitsEvent(list, "change", ownerInstance); +} + +function touchEnd(e, ownerInstance, event) { + var ins = null + var st = {} + if (isH5 && isPC()) { + ins = event.instance + st = event.instance.getState() + } else { + st = e.instance.getState() + ins = e.instance + } + if (!st.dragging || !st.isDrag) return; + emitsEvent(st.list, "sortend", ownerInstance); + ins.addClass("fui-drag__trans-end") + ins.setStyle({ + 'transform': 'translate3d(' + st.list[st.cur].transX + ',' + st.list[st.cur].transY + ', 0)' + }); + st.itemsInstance.forEach(function(item, index) { + item.removeClass("fui-drag__trans").removeClass("fui-drag__cur"); + }) + st.prevIns = ins + st.preStartKey = -1; + st.dragging = false; + // #ifdef MP-WEIXIN + ownerInstance.callMethod("drag", { + wxdrag: false + }); + // #endif + st.cur = -1; + st.transX = 0; + st.transY = 0; +} + +function paramChange(newVal, oldVal, ownerInstance, ins) { + wrapParam.param = newVal; +} + +function listChange(newVal, oldVal, ownerInstance, ins) { + wrapParam.itemsInstance = ownerInstance.selectAllComponents('.fui-drag-item__wrap'); + wrapParam.list = newVal || []; + if (!wrapParam.itemsInstance || wrapParam.itemsInstance.length === 0) return; + + wrapParam.list.forEach(function(item, index) { + var itemIns = wrapParam.itemsInstance[index]; + if (item && itemIns) { + itemIns.setStyle({ + 'transform': 'translate3d(' + item.transX + ',' + item.transY + ', 0)' + }); + } + }) +} + +var movable = false; + +function mousedown(e, ins) { + if (!isH5 || !isPC()) return + touchStart(e, ins) + longPress(e, ins) + movable = true + window.onmousemove = function(event) { + if (!isH5 || !isPC() || !movable) return + touchMove(event, ins, e) + } + window.onmouseup = function(event) { + if (!isH5 || !isPC() || !movable) return + touchEnd(event, ins, e) + movable = false + } +} + + +function stopTouchMove(e) { + return true +} + +module.exports = { + longPress: longPress, + touchStart: touchStart, + touchMove: touchMove, + touchEnd: touchEnd, + paramChange: paramChange, + listChange: listChange, + mousedown: mousedown, + stopTouchMove:stopTouchMove +} \ No newline at end of file diff --git a/components/firstui/fui-drag/mpjs.js b/components/firstui/fui-drag/mpjs.js new file mode 100644 index 0000000..4646981 --- /dev/null +++ b/components/firstui/fui-drag/mpjs.js @@ -0,0 +1,145 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8 6140 7 2 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +// #ifndef APP-PLUS || MP-WEIXIN || H5 + +export default { + data() { + return { + current: -1, + transX: '0px', + transY: '0px', + startTouch: null, + tDragging: false, + sId: null, + preStartKey: null + } + }, + methods: { + outOfRange(x1, y1, x2, y2, x3, y3) { + return x1 < 0 || x1 >= y1 || x2 < 0 || x2 >= y2 || x3 < 0 || x3 >= y3 + }, + listSort(sKey, eKey) { + let endRealKey = -1; + this.list.forEach((item) => { + if (item.sortKey === eKey) endRealKey = item.realKey; + }); + + return this.list.map((item) => { + let cKey = item.sortKey; + let rKey = item.realKey; + if (sKey < eKey) { + if (cKey > sKey && cKey <= eKey) { + --rKey; + --cKey; + } else if (cKey === sKey) { + rKey = endRealKey; + cKey = eKey; + } + } else if (sKey > eKey) { + if (cKey >= eKey && cKey < sKey) { + ++rKey; + ++cKey; + } else if (cKey === sKey) { + rKey = endRealKey; + cKey = eKey; + } + } + if (item.sortKey !== cKey) { + let columns = Number(this.columns) + item.transX = (cKey % columns) * this.cellWidth + "px"; + item.transY = Math.floor(cKey / columns) * this.cellHeight + "px"; + item.sortKey = cKey; + item.realKey = rKey; + } + return item; + }); + }, + emitsEvent(list, type) { + let changeList = [], + itemList = []; + + list.forEach((item) => { + changeList[item.sortKey] = item; + }); + + changeList.forEach((item) => { + itemList.push(item.entity); + }); + if (type == "change") { + this.change({ + itemList: itemList + }); + } else { + this.sortend({ + itemList: itemList + }); + } + }, + longPress(e) { + if (!this.isDrag) return; + let touch = e.changedTouches && e.changedTouches[0] ? e.changedTouches[0] : this.startTouch; + if (!touch) return; + this.current = Number(e.currentTarget.dataset.index); + + if (this.tDragging) return; + //pageX + this.transX = this.columns == 1 ? 0 : touch.clientX - (this.cellWidth / 2 + this.wrapLeft) + 'px'; + this.transY = touch.clientY - (this.cellHeight / 2 + this.wrapTop) + 'px'; + this.sId = touch.identifier; + this.tDragging = true; + }, + touchstart(e) { + if (!this.isDrag) return; + this.startTouch = e.changedTouches[0] || e.touches[0]; + }, + touchmove(e) { + if (!this.isDrag || !this.tDragging) return; + let touch = e.changedTouches[0] || e.touches[0]; + if (!touch || this.sId !== touch.identifier) return; + let transX = this.columns == 1 ? 0 : touch.clientX - (this.cellWidth / 2 + this.wrapLeft); + let transY = touch.clientY - (this.cellHeight / 2 + this.wrapTop); + + if (touch.clientY > this.windowHeight - this.cellHeight) { + this.pageScroll({ + scrollTop: touch.pageY + this.cellHeight - this.windowHeight + }) + } else if (touch.clientY < this.cellHeight) { + this.pageScroll({ + scrollTop: touch.pageY - this.cellHeight + }) + } + this.transX = transX + 'px' + this.transY = transY + 'px' + + let startKey = this.list[this.current].sortKey; + let curX = Math.round(transX / this.cellWidth); + let curY = Math.round(transY / this.cellHeight); + let endKey = curX + Number(this.columns) * curY; + + if (this.outOfRange(curX, Number(this.columns), curY, this.rows, endKey, this.list.length)) return; + + if (startKey === endKey || startKey === this.preStartKey) return; + this.preStartKey = startKey; + + let list = this.listSort(startKey, endKey); + this.listChange({ + itemList: list + }) + this.emitsEvent(list, "change"); + }, + touchend(e) { + if (!this.isDrag || !this.tDragging) return; + this.emitsEvent(this.list, "sortend"); + this.preStartKey = -1; + this.tDragging = false; + this.current = -1; + this.transX = '0px'; + this.transY = '0px'; + } + } +} + +// #endif + +// #ifdef APP-PLUS|| MP-WEIXIN || H5 +export default {} +// #endif \ No newline at end of file diff --git a/components/firstui/fui-drawer/fui-drawer.vue b/components/firstui/fui-drawer/fui-drawer.vue new file mode 100644 index 0000000..69daa21 --- /dev/null +++ b/components/firstui/fui-drawer/fui-drawer.vue @@ -0,0 +1,250 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-dropdown-list/fui-dropdown-list.vue b/components/firstui/fui-dropdown-list/fui-dropdown-list.vue new file mode 100644 index 0000000..6b831ca --- /dev/null +++ b/components/firstui/fui-dropdown-list/fui-dropdown-list.vue @@ -0,0 +1,468 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-dropdown-menu/fui-dropdown-menu.vue b/components/firstui/fui-dropdown-menu/fui-dropdown-menu.vue new file mode 100644 index 0000000..392b788 --- /dev/null +++ b/components/firstui/fui-dropdown-menu/fui-dropdown-menu.vue @@ -0,0 +1,562 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-empty/fui-empty.vue b/components/firstui/fui-empty/fui-empty.vue new file mode 100644 index 0000000..00fc603 --- /dev/null +++ b/components/firstui/fui-empty/fui-empty.vue @@ -0,0 +1,131 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-fab/bindingx.js b/components/firstui/fui-fab/bindingx.js new file mode 100644 index 0000000..adbda94 --- /dev/null +++ b/components/firstui/fui-fab/bindingx.js @@ -0,0 +1,83 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8 6 1 40 7 2549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +// #ifdef APP-NVUE +const animation = uni.requireNativePlugin('animation'); +export default { + data() { + return { + startX: 0, + startY: 0, + lastLeft: 0, + lastTop: 0, + isMove: false + } + }, + created() { + this.refFab = null; + this.loop = null + }, + mounted() { + this.$nextTick(() => { + setTimeout(() => { + this.refFab = this.getEl(this.$refs['fui_fab_move_ref']) + }, 50) + }) + }, + methods: { + getEl(el) { + return el.ref || el[0].ref; + }, + _aniMove(x, y) { + if (!this.refFab || !this.isDrag) return + animation.transition(this.refFab, { + styles: { + transform: `translate(${x}px,${y}px)` + }, + duration: 0, + timingFunction: 'linear', + needLayout: false, + delay: 0 + }, () => { + if (Math.abs(x) > 0.1 || Math.abs(y) > 0.1) { + this.isMove = true; + } + }); + }, + touchstart(e) { + if (!this.isDrag) return; + var touch = e.touches || e.changedTouches + this.startX = touch[0].screenX + this.startY = touch[0].screenY + }, + touchmove(e) { + if (!this.isDrag) return; + var touch = e.touches || e.changedTouches + let pageX = touch[0].screenX, + pageY = touch[0].screenY; + var left = pageX - this.startX + this.lastLeft; + left = left < -this.eLeft ? -this.eLeft : left; + left = left > this.maxWidth ? this.maxWidth : left; + this.startX = pageX + + var top = pageY - this.startY + this.lastTop; + top = top < -this.eTop ? -this.eTop : top; + top = top > this.maxHeight ? this.maxHeight : top; + this.startY = pageY + + this.lastLeft = left + this.lastTop = top + this._aniMove(left, top) + }, + touchend(e) { + clearTimeout(this.loop) + this.loop = setTimeout(() => { + this.isMove = false + }, 50) + } + } +} + +// #endif + +// #ifndef APP-NVUE +export default {} +// #endif \ No newline at end of file diff --git a/components/firstui/fui-fab/fui-fab.vue b/components/firstui/fui-fab/fui-fab.vue new file mode 100644 index 0000000..0568f4d --- /dev/null +++ b/components/firstui/fui-fab/fui-fab.vue @@ -0,0 +1,607 @@ + + + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-fab/index.wxs b/components/firstui/fui-fab/index.wxs new file mode 100644 index 0000000..3dfaecb --- /dev/null +++ b/components/firstui/fui-fab/index.wxs @@ -0,0 +1,120 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:186 14 07 2 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +var movable = { + width: 100, + height: 100, + disabled: false, + left: 0, + top: 0 +} + +function isPC() { + if (typeof navigator !== 'object') return false; + var userAgentInfo = navigator.userAgent; + var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; + var flag = true; + for (var v = 0; v < Agents.length - 1; v++) { + if (userAgentInfo.indexOf(Agents[v]) > 0) { + flag = false; + break; + } + } + return flag; +} +var isH5 = false +if (typeof window === 'object') isH5 = true + +function setInitValue(dataset) { + movable.width = +dataset.width + movable.height = +dataset.height + movable.top = +dataset.top + movable.left = +dataset.left + //H5获取bool值为undefined + movable.disabled = (+dataset.disabled) == 1 ? true : false +} + +function touchstart(e, ins) { + var state = e.instance.getState() + var touch = e.touches[0] || e.changedTouches[0]; + if (isH5 && isPC()) { + touch = e; + } + var dataset = e.instance.getDataset() + state.startX = touch.clientX + state.startY = touch.clientY + setInitValue(dataset) +} + +function styleChange(left, top, ins) { + if (!ins) return; + var mview = ins.selectComponent('.fui-fab__btn-wrap'); + if (!mview) return; + mview.setStyle({ + transform: 'translate3d(' + left + 'px,' + top + 'px,0)' + }) +} + +function touchmove(e, ins, event) { + if (movable.disabled) return; + if (e.preventDefault) { + // 阻止页面滚动 + e.preventDefault() + } + var state = {} + var touch = {} + if (isH5 && isPC()) { + touch = e; + state = event.instance.getState() + } else { + touch = e.touches[0] || e.changedTouches[0] + state = e.instance.getState() + } + var pageX = touch.clientX; + var pageY = touch.clientY; + var left = pageX - state.startX + (state.lastLeft || 0); + left = left < -movable.left ? -movable.left : left; + left = left > movable.width ? movable.width : left; + state.startX = pageX + + var top = pageY - state.startY + (state.lastTop || 0); + top = top < -movable.top ? -movable.top : top; + top = top > movable.height ? movable.height : top; + state.startY = pageY + + state.lastLeft = left + state.lastTop = top + styleChange(left, top, ins) +} + +var _movable = false; + +function mousedown(e, ins) { + if (!isH5 || !isPC()) return + touchstart(e, ins) + _movable = true + window.onmousemove = function(event) { + if (!isH5 || !isPC() || !_movable) return + touchmove(event, ins, e) + } + window.onmouseup = function(event) { + if (!isH5 || !isPC() || !_movable) return + _movable = false + } +} + +function fabreset(reset, oldreset, owner, ins) { + if (reset > 0) { + var state = ins.getState() + state.startY = 0; + state.startX = 0; + state.lastLeft = 0; + state.lastTop = 0; + styleChange(0, 0, owner) + } +} + +module.exports = { + touchstart: touchstart, + touchmove: touchmove, + mousedown: mousedown, + fabreset: fabreset +} \ No newline at end of file diff --git a/components/firstui/fui-fab/mpjs.js b/components/firstui/fui-fab/mpjs.js new file mode 100644 index 0000000..ec332a7 --- /dev/null +++ b/components/firstui/fui-fab/mpjs.js @@ -0,0 +1,59 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:1 8 6 14 0 7 2549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +// #ifndef APP-PLUS || MP-WEIXIN || H5 +export default { + data() { + return { + startX: 0, + startY: 0, + lastLeft: 0, + lastTop: 0, + transform: '' + } + }, + watch: { + resetNum(val) { + if (val > 0) { + this.startX = 0; + this.startY = 0; + this.lastLeft = 0; + this.lastTop = 0; + this.transform = 'translate3d(0,0,0)' + } + } + }, + methods: { + touchstart(e) { + if (!this.isDrag) return; + const touch = e.touches || e.changedTouches + this.startX = touch[0].clientX + this.startY = touch[0].clientY + }, + touchmove(e) { + if (!this.isDrag) return; + const touch = e.touches || e.changedTouches + let pageX = touch[0].clientX, + pageY = touch[0].clientY; + + var left = pageX - this.startX + this.lastLeft; + left = left < -this.eLeft ? -this.eLeft : left; + left = left > this.maxWidth ? this.maxWidth : left; + this.startX = pageX + + var top = pageY - this.startY + this.lastTop; + top = top < -this.eTop ? -this.eTop : top; + top = top > this.maxHeight ? this.maxHeight : top; + this.startY = pageY + + + this.lastLeft = left + this.lastTop = top + this.transform = `translate3d(${left}px,${top}px,0)` + } + } +} + +// #endif + +// #ifdef APP-PLUS|| MP-WEIXIN || H5 +export default {} +// #endif \ No newline at end of file diff --git a/components/firstui/fui-filter-bar/fui-filter-bar.vue b/components/firstui/fui-filter-bar/fui-filter-bar.vue new file mode 100644 index 0000000..5e0dfa1 --- /dev/null +++ b/components/firstui/fui-filter-bar/fui-filter-bar.vue @@ -0,0 +1,230 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-footer/fui-footer.vue b/components/firstui/fui-footer/fui-footer.vue new file mode 100644 index 0000000..8480aa2 --- /dev/null +++ b/components/firstui/fui-footer/fui-footer.vue @@ -0,0 +1,221 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-form-field/fui-form-field.vue b/components/firstui/fui-form-field/fui-form-field.vue new file mode 100644 index 0000000..0684f86 --- /dev/null +++ b/components/firstui/fui-form-field/fui-form-field.vue @@ -0,0 +1,37 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-form-item/fui-form-item.vue b/components/firstui/fui-form-item/fui-form-item.vue new file mode 100644 index 0000000..cefd4ee --- /dev/null +++ b/components/firstui/fui-form-item/fui-form-item.vue @@ -0,0 +1,314 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-form/fui-form.vue b/components/firstui/fui-form/fui-form.vue new file mode 100644 index 0000000..80add08 --- /dev/null +++ b/components/firstui/fui-form/fui-form.vue @@ -0,0 +1,253 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-form/fui-validator.js b/components/firstui/fui-form/fui-validator.js new file mode 100644 index 0000000..9119fc8 --- /dev/null +++ b/components/firstui/fui-form/fui-validator.js @@ -0,0 +1,335 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 186 14 07 25 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +/** + * 表单验证 + * https://doc.firstui.cn/ + **/ + +const form = { + /* + 非必填情况下,如果值为空则不进行校验 + */ + validator: function(formData, rules, checkAll = false) { + let result = { + isPassed: true, + errorMsg: checkAll ? [] : '' + }; + for (let item of rules) { + const key = item.name; + const rule = item.rule || []; + const validator = item.validator || []; + const msgArr = item.msg || []; + const ruleLen = rule.length; + const validatorLen = validator.length; + if (!key || (ruleLen === 0 && validatorLen === 0) || (!~rule.indexOf("required") && + formData[key].toString() + .length === 0)) { + continue; + } + if (ruleLen) { + for (let i = 0; i < ruleLen; i++) { + let ruleItem = rule[i]; + let msg = msgArr[i] || `${key} error !`; + if (!ruleItem) continue; + //数据处理 + let value = null; + if (~ruleItem.indexOf(":")) { + let temp = ruleItem.split(":"); + ruleItem = temp[0]; + value = temp[1]; + } + let isError = false; + switch (ruleItem) { + case "required": + isError = form._isNullOrEmpty(formData[key]); + break; + case "isMobile": + isError = !form._isMobile(formData[key]); + break; + case "isEmail": + isError = !form._isEmail(formData[key]); + break; + case "isCarNo": + isError = !form._isCarNo(formData[key]); + break; + case "isIdCard": + isError = !form._isIdCard(formData[key]); + break; + case "isAmount": + isError = !form._isAmount(formData[key]); + break; + case "isNumber": + isError = !form._isNumber(formData[key]); + break; + case "isChinese": + isError = !form._isChinese(formData[key]); + break; + case "isNotChinese": + isError = !form._isNotChinese(formData[key]); + break; + case "isEnglish": + isError = !form._isEnglish(formData[key]); + break; + case "isEnAndNo": + isError = !form._isEnAndNo(formData[key]); + break; + case "isEnOrNo": + isError = !form._isEnOrNo(formData[key]); + break; + case "isSpecial": + isError = form._isSpecial(formData[key]); + break; + case "isEmoji": + isError = form._isEmoji(formData[key]); + break; + case "isDate": + isError = !form._isDate(formData[key]); + break; + case "isUrl": + isError = !form._isUrl(formData[key]); + break; + case "isSame": + isError = !form._isSame(formData[key], formData[value]); + break; + case "range": + let range = null; + try { + range = JSON.parse(value); + if (range.length <= 1) { + throw new Error("range值传入有误!") + } + } catch (e) { + return "range值传入有误!" + } + isError = !form._isRange(formData[key], range[0], range[1]) + break; + case "minLength": + isError = !form._minLength(formData[key], value) + break; + case "maxLength": + isError = !form._maxLength(formData[key], value) + break; + case "isKeyword": + isError = !form._isKeyword(formData[key], value) + break; + default: + break; + } + + if (isError) { + result.isPassed = false; + if (checkAll) { + result.errorMsg.push({ + name: key, + msg: msg + }) + break; + } else { + result.errorMsg = msg; + return result; + } + } + } + } + + if (validatorLen) { + for (let model of validator) { + let func = model.method; + if (func && !func(formData[key])) { + result.isPassed = false; + if (checkAll) { + const index = result.errorMsg.findIndex(item => item.name === key) + if (index === -1) { + result.errorMsg.push({ + name: key, + msg: model.msg || `${key} error !` + }) + } + break; + } else { + result.errorMsg = model.msg || `${key} error !`; + return result; + } + } + } + } + } + return result; + }, + //允许填写字符串null或者undefined + _isNullOrEmpty: function(value) { + return (value === null || value === '' || value === undefined) ? true : false; + }, + _isMobile: function(value) { + return /^(?:13\d|14\d|15\d|16\d|17\d|18\d|19\d)\d{5}(\d{3}|\*{3})$/.test(value); + }, + _isEmail: function(value) { + return /^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(value); + }, + _isCarNo: function(value) { + // 新能源车牌 + const xreg = + /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/; + // 旧车牌 + const creg = + /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1}$/; + if (value.length === 7) { + return creg.test(value); + } else if (value.length === 8) { + return xreg.test(value); + } else { + return false; + } + }, + _isIdCard: function(value) { + let idCard = value; + if (idCard.length == 15) { + return this.__isValidityBrithBy15IdCard; + } else if (idCard.length == 18) { + let arrIdCard = idCard.split(""); + if (this.__isValidityBrithBy18IdCard(idCard) && this.__isTrueValidateCodeBy18IdCard(arrIdCard)) { + return true; + } else { + return false; + } + } else { + return false; + } + }, + __isTrueValidateCodeBy18IdCard: function(arrIdCard) { + let sum = 0; + let Wi = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1]; + let ValideCode = [1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2]; + if (arrIdCard[17].toLowerCase() == 'x') { + arrIdCard[17] = 10; + } + for (let i = 0; i < 17; i++) { + sum += Wi[i] * arrIdCard[i]; + } + let valCodePosition = sum % 11; + if (arrIdCard[17] == ValideCode[valCodePosition]) { + return true; + } else { + return false; + } + }, + __isValidityBrithBy18IdCard: function(idCard18) { + let year = idCard18.substring(6, 10); + let month = idCard18.substring(10, 12); + let day = idCard18.substring(12, 14); + let temp_date = new Date(year, parseFloat(month) - 1, parseFloat(day)); + if (temp_date.getFullYear() != parseFloat(year) || temp_date.getMonth() != parseFloat(month) - 1 || + temp_date.getDate() != + parseFloat(day)) { + return false; + } else { + return true; + } + }, + __isValidityBrithBy15IdCard: function(idCard15) { + let year = idCard15.substring(6, 8); + let month = idCard15.substring(8, 10); + let day = idCard15.substring(10, 12); + let temp_date = new Date(year, parseFloat(month) - 1, parseFloat(day)); + + if (temp_date.getYear() != parseFloat(year) || temp_date.getMonth() != parseFloat(month) - 1 || + temp_date.getDate() != + parseFloat(day)) { + return false; + } else { + return true; + } + }, + _isAmount: function(value) { + //是否为金额,只允许保留两位小数 + return /^([0-9]*[.]?[0-9])[0-9]{0,1}$/.test(value); + }, + _isNumber: function(value) { + //是否全为数字 + return /^[0-9]+$/.test(value); + }, + //是否全部为中文 + _isChinese: function(value) { + let reg = /^[\u4e00-\u9fa5]+$/; + return value !== "" && reg.test(value) && !form._isSpecial(value) && !form._isEmoji(value) + }, + //是否不包含中文,可以有特殊字符 + _isNotChinese: function(value) { + let reg = /.*[\u4e00-\u9fa5]+.*$/; + let result = true; + if (reg.test(value)) { + result = false + } + return result + }, + _isEnglish: function(value) { + return /^[a-zA-Z]*$/.test(value) + }, + _isEnAndNo: function(value) { + //4~30位数字和字母组合 + return /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{4,30}$/.test(value); + }, + _isEnOrNo: function(value) { + let reg = /^[A-Za-z0-9]+$/; + return reg.test(value) + }, + _isSpecial: function(value) { + //是否包含特殊字符 + let regEn = /[`~!@#$%^&*()_+<>?:"{},.\/;'[\]]/im, + regCn = /[·!#¥(——):;“”‘、,|《。》?、【】[\]]/im; + if (regEn.test(value) || regCn.test(value)) { + return true; + } + return false; + }, + _isEmoji: function(value) { + //是否包含表情 + return /\uD83C[\uDF00-\uDFFF]|\uD83D[\uDC00-\uDE4F]/g.test(value); + }, + _isDate: function(value) { + //2019-10-12 + const reg = + /^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$/; + return reg.test(value); + }, + _isUrl: function(value) { + return /^((https?|ftp|file):\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})(:[0-9]{1,5})?((\/?)|(\/[\\\w_!~*\\'()\\\.;?:@&=+$,%#-]+)+\/?)$/ + .test(value); + }, + _isSame: function(value1, value2) { + return value1 === value2 + }, + _isRange: function(value, range1, range2) { + if ((!range1 && range1 != 0) && (!range2 && range2 != 0)) { + return true; + } else if (!range1 && range1 != 0) { + return value <= range2 + } else if (!range2 && range2 != 0) { + return value >= range1 + } else { + return value >= range1 && value <= range2 + } + }, + _minLength: function(value, min) { + return value.length >= Number(min) + }, + _maxLength: function(value, max) { + return value.length <= Number(max) + }, + _isKeyword: function(value, keywords) { + //是否包含关键词,敏感词,多个以英文逗号分隔,包含则为false,弹出提示语! + let result = true; + if (!keywords) return result; + let key = keywords.split(','); + for (let i = 0, len = key.length; i < len; i++) { + if (~value.indexOf(key[i])) { + result = false; + break; + } + } + return result; + } +}; + +export default { + validator: form.validator +} \ No newline at end of file diff --git a/components/firstui/fui-gallery/fui-gallery.vue b/components/firstui/fui-gallery/fui-gallery.vue new file mode 100644 index 0000000..af0df07 --- /dev/null +++ b/components/firstui/fui-gallery/fui-gallery.vue @@ -0,0 +1,276 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-grid-item/fui-grid-item.vue b/components/firstui/fui-grid-item/fui-grid-item.vue new file mode 100644 index 0000000..ca1061c --- /dev/null +++ b/components/firstui/fui-grid-item/fui-grid-item.vue @@ -0,0 +1,182 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-grid/fui-grid.vue b/components/firstui/fui-grid/fui-grid.vue new file mode 100644 index 0000000..4f36af6 --- /dev/null +++ b/components/firstui/fui-grid/fui-grid.vue @@ -0,0 +1,269 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-horizontal-scroll/bindingx.js b/components/firstui/fui-horizontal-scroll/bindingx.js new file mode 100644 index 0000000..2fb2bad --- /dev/null +++ b/components/firstui/fui-horizontal-scroll/bindingx.js @@ -0,0 +1,42 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 186 140 7 2 54 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +// #ifdef APP-NVUE +const BindingX = uni.requireNativePlugin('bindingx'); +export default { + methods: { + getEl(el) { + return this.$refs[el].ref; + }, + nvueScrollHandler(e) { + const anchor = this.getEl('fui_scroller_view') + const element = this.getEl('fui_hor_indicator') + const scrollLeft = e.contentOffset.x + const contentWidth = e.contentSize.width + if (this.scroll && element) { + const barAllMoveWidth = this.bgWidth - this.blockWidth + const platform = uni.getSystemInfoSync().platform + const actionNum = platform.toLowerCase() === 'ios' ? 2 : 1 + const expression = `(x / ${actionNum}) / ${contentWidth - this.width} * ${barAllMoveWidth}` + BindingX.bind({ + anchor, + eventType: 'scroll', + props: [{ + element, + property: 'transform.translateX', + expression + }] + }) + } + if (scrollLeft + this.width === contentWidth) { + this.scrollEvent('right') + } else if (scrollLeft === 0) { + this.scrollEvent('left') + } + } + } +} + +// #endif + +// #ifndef APP-NVUE +export default {} +// #endif \ No newline at end of file diff --git a/components/firstui/fui-horizontal-scroll/fui-horizontal-scroll.vue b/components/firstui/fui-horizontal-scroll/fui-horizontal-scroll.vue new file mode 100644 index 0000000..8f7c488 --- /dev/null +++ b/components/firstui/fui-horizontal-scroll/fui-horizontal-scroll.vue @@ -0,0 +1,271 @@ + + + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-horizontal-scroll/index.wxs b/components/firstui/fui-horizontal-scroll/index.wxs new file mode 100644 index 0000000..f3f3a81 --- /dev/null +++ b/components/firstui/fui-horizontal-scroll/index.wxs @@ -0,0 +1,39 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 186140 7 2 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +function scroll(event, ownerInstance) { + var detail = event.detail + var scrollWidth = detail.scrollWidth + var scrollLeft = detail.scrollLeft + var dataset = event.currentTarget.dataset + var width = dataset.width || 0 + var scrollBarWidth = dataset.bgwidth || 0 + var blockWidth = dataset.blockwidth || 0 + var x = scrollLeft / (scrollWidth - width) * (scrollBarWidth - blockWidth) + setBarStyle(ownerInstance, x) +} + +function scrolltolower(event, ownerInstance) { + ownerInstance.callMethod('scrollEvent', 'right') + var dataset = event.currentTarget.dataset + var scrollBarWidth = dataset.bgwidth || 0 + var blockWidth = dataset.blockwidth || 0 + setBarStyle(ownerInstance, scrollBarWidth - blockWidth) +} + +function scrolltoupper(event, ownerInstance) { + ownerInstance.callMethod('scrollEvent', 'left') + setBarStyle(ownerInstance, 0) +} + +function setBarStyle(ownerInstance, x) { + var block = ownerInstance.selectComponent('.fui-hor__scroll-indicator') + block && block.setStyle({ + transform: 'translate3d(' + x + 'px,0,0)' + }) + +} + +module.exports = { + scroll: scroll, + scrolltolower: scrolltolower, + scrolltoupper: scrolltoupper +} \ No newline at end of file diff --git a/components/firstui/fui-horizontal-scroll/mpjs.js b/components/firstui/fui-horizontal-scroll/mpjs.js new file mode 100644 index 0000000..98f8d1c --- /dev/null +++ b/components/firstui/fui-horizontal-scroll/mpjs.js @@ -0,0 +1,32 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 61407 2 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +// #ifndef APP-PLUS || MP-WEIXIN || H5 + +export default { + methods: { + scrollHandler(event) { + const detail = event.detail + const scrollWidth = detail.scrollWidth + const scrollLeft = detail.scrollLeft + const width = this.width + const scrollBarWidth = this.bgWidth + const blockWidth = this.blockWidth + const x = scrollLeft / (scrollWidth - width) * (scrollBarWidth - blockWidth) + this.transform = `translate3d(${x}px,0,0)` + }, + scrolltoupper(event) { + this.scrollEvent('left') + this.transform = 'translate3d(0,0,0)' + }, + scrolltolower(event) { + this.scrollEvent('right') + const x = this.bgWidth - this.blockWidth + this.transform = `translate3d(${x}px,0,0)` + } + } +} + +// #endif + +// #ifdef APP-PLUS|| MP-WEIXIN || H5 +export default {} +// #endif \ No newline at end of file diff --git a/components/firstui/fui-icon/fui-icon.js b/components/firstui/fui-icon/fui-icon.js new file mode 100644 index 0000000..e71aa7c --- /dev/null +++ b/components/firstui/fui-icon/fui-icon.js @@ -0,0 +1,166 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:186 140 72 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +export default { + "addressbook":"\ue80c", + "addfriends-fill": "\ue80a", + "addfriends": "\ue80b", + "backspace-fill": "\ue808", + "backspace": "\ue809", + "bankcard-fill": "\ue806", + "bankcard": "\ue807", + "camera-fill": "\ue804", + "camera": "\ue805", + "captcha-fill": "\ue802", + "captcha": "\ue803", + "cart-fill": "\ue800", + "cart": "\ue801", + "classify": "\ue7fe", + "classify-fill": "\ue7ff", + "comment-fill": "\ue7fc", + "comment": "\ue7fd", + "community-fill": "\ue7fa", + "community": "\ue7fb", + "coupon-fill": "\ue7f8", + "coupon": "\ue7f9", + "delete": "\ue7f6", + "delete-fill": "\ue7f7", + "edit": "\ue7f4", + "edit-fill": "\ue7f5", + "fabulous-fill": "\ue7f2", + "fabulous": "\ue7f3", + "find": "\ue7f0", + "find-fill": "\ue7f1", + "help-fill": "\ue7ee", + "help": "\ue7ef", + "home-fill": "\ue7ec", + "home": "\ue7ed", + "idcard-fill": "\ue7ea", + "idcard": "\ue7eb", + "info": "\ue7e8", + "info-fill": "\ue7e9", + "invite-fill": "\ue7e6", + "invite": "\ue7e7", + "kefu-fill": "\ue7e4", + "kefu": "\ue7e5", + "like-fill": "\ue7e2", + "like": "\ue7e3", + "location": "\ue7e0", + "location-fill": "\ue7e1", + "lock": "\ue7de", + "lock-fill": "\ue7df", + "mail-fill": "\ue7dc", + "mail": "\ue7dd", + "message": "\ue7da", + "message-fill": "\ue7db", + "mobile-fill": "\ue7d8", + "mobile": "\ue7d9", + "more": "\ue7d6", + "more-fill": "\ue7d7", + "my-fill": "\ue7d4", + "my": "\ue7d5", + "principal":"\ue80d", + "notice-fill": "\ue7d2", + "notice": "\ue7d3", + "order": "\ue7d0", + "order-fill": "\ue7d1", + "picture": "\ue7ce", + "picture-fill": "\ue7cf", + "setup-fill": "\ue7cc", + "setup": "\ue7cd", + "share": "\ue7ca", + "share-fill": "\ue7cb", + "shop": "\ue7c8", + "shop-fill": "\ue7c9", + "star-fill": "\ue7c5", + "star": "\ue7c6", + "starhalf": "\ue7c7", + "stepon-fill": "\ue7c3", + "stepon": "\ue7c4", + "wait-fill": "\ue7c1", + "wait": "\ue7c2", + "warning": "\ue7bf", + "warning-fill": "\ue7c0", + "plus": "\ue7bc", + "plussign-fill": "\ue7bd", + "plussign": "\ue7be", + "minus": "\ue7b9", + "minussign": "\ue7ba", + "minussign-fill": "\ue7bb", + "close": "\ue7b8", + "clear": "\ue7b6", + "clear-fill": "\ue7b7", + "checkbox-fill": "\ue7b5", + "checkround": "\ue7b4", + "checkbox": "\ue7b3", + "check": "\ue7b2", + "pulldown-fill": "\ue7ae", + "pullup": "\ue7af", + "pullup-fill": "\ue7b0", + "pulldown": "\ue7b1", + "roundright-fill": "\ue7ac", + "roundright": "\ue7ad", + "arrowright": "\ue7a9", + "arrowleft": "\ue7aa", + "arrowdown": "\ue7ab", + "left": "\ue7a6", + "up": "\ue7a7", + "right": "\ue7a8", + "back": "\ue7a3", + "top": "\ue7a4", + "dropdown": "\ue7a5", + "turningleft": "\ue79f", + "turningup": "\ue7a0", + "turningright": "\ue7a1", + "turningdown": "\ue7a2", + "refresh": "\ue79c", + "loading": "\ue79d", + "search": "\ue79e", + "rotate": "\ue79b", + "screen": "\ue79a", + "signin": "\ue799", + "calendar": "\ue798", + "scan": "\ue797", + "qrcode": "\ue796", + "wallet": "\ue795", + "telephone": "\ue794", + "visible": "\ue793", + "invisible": "\ue792", + "menu": "\ue78e", + "operate": "\ue78f", + "slide": "\ue790", + "list": "\ue791", + "nonetwork": "\ue78d", + "partake": "\ue78c", + "qa": "\ue78b", + "barchart": "\ue788", + "piechart": "\ue789", + "linechart": "\ue78a", + "at": "\ue787", + "face": "\ue77f", + "redpacket": "\ue780", + "suspend": "\ue781", + "link": "\ue782", + "keyboard": "\ue783", + "play": "\ue784", + "video": "\ue785", + "voice": "\ue786", + "sina": "\ue77a", + "browser": "\ue77b", + "moments": "\ue77c", + "qq": "\ue77d", + "wechat": "\ue77e", + "balance": "\ue779", + "bankcardpay": "\ue778", + "wxpay": "\ue777", + "alipay": "\ue776", + "payment":"\ue818", + "receive":"\ue817", + "sendout":"\ue816", + "evaluate":"\ue815", + "aftersale":"\ue814", + "warehouse":"\ue813", + "transport":"\ue812", + "delivery":"\ue811", + "switch":"\ue810", + "goods":"\ue80f", + "goods-fill":"\ue80e" +} \ No newline at end of file diff --git a/components/firstui/fui-icon/fui-icon.ttf b/components/firstui/fui-icon/fui-icon.ttf new file mode 100644 index 0000000000000000000000000000000000000000..8bbc644afa6970f8c041dbf1db6eb6b555e9e357 GIT binary patch literal 39840 zcmeFa378v4wLeoB+hTe`N*zI zb{vvV9{3_-hN~H~F1>L7l^5Ky&G$XV+&;#xAK1HR$L^ND{_%Ua`cKjkiq?a!S}o{tSBq`4B244(zyO&rM%{ zUn^sGE<*jyhYntP^!wg*S2FhAM;J5x7X$3_=&4b*#h~96N5ZD@?-9KOrGvL`__yt@ znSWw7QTN1eo-a{F@qOwU1C!_A)Xb#X<#eY<*sqvJKc`YF{uw)^pNl71SuY!6(){72 zYnXHYj-v-ygo)dW-y8FM|Go=%;Qrzlj(YSfM+s-9TB*Un_#Mm$TyK)Tg|gelH-C-w zb6hDgqm0ri{#IPDU^g4996K4(+k?qJW22}xxiutu;QvYgrw#tULIWU2&^kB|W1WID zrMm^q@;gyV)Z2+~j5?GX_yu|$3=zgohE8D|R*umT=Y-J1>>>6bJI?N5_p)0rJ zE4!9m#ja-8u*=yM>`L|)c9dPlj3*2>ygmgQIr z%diwnvjj`BIBRAx)&x!zWg!-30TyIF=4W1}GB>!Hlew6K*}?Oz%mVJCfcqHHf-=|( zT9y+p`v3c%of<&-bgda4CQ1_tRK_Zoiv)UOl`BL7<*^Fn5+%?et3ZZQ0yVPARU&~d zSp{;F5-5~at`P~e$|~221gd3~w~7S%WtCBpK*_9fok*Z*R=HjzP&cdGAQI@DRo*5N zD4tc`E)r;;Ro)>IMggnbC=$j4tGrVrj0{$}NhFLBR=HUuj22e8MI?+HR=HIqj38F2 zC5$Cjq2G`&s#t~Yg@p0NDs(Rr`E)@H1RldGkBJ0s!zv#W34DiD9v2B5h*dr=5_l1-d_p8} zC06+tk-(o=alai3HxpDxVPvT#i*f zD-!q}t9(u*a6VS~yhz}ItnvkszztdD{}PFf;QNarfkU#&(;|UavdWi40@q}fXG8-3 zWR)?Iz)4x<%OZiNvdXg}fxEKGS40AzWtHbd0>@>Qe-#P5msP$h61Xs{d`%?qV^;aP zNZ`z@@^2!6N3+T|L;|;Fm2Zj!zRfD%5(ylfRlY3}csZ+lMnMj666J|{6r*H#`jM} zf(&7m7e#_JVU>Ru337#1ekKwm46FQyNRTzG@{&l9I;`@tNRU6QazZ3XB3AiNksy;; z<>w+nIZiD!&p5QjAq9B0-+9%1MzR*;wV*B0eWCJOksu3M<#!@MDzeJ|5()B=RemoLBqgi7E)rxWtGpo+q$jKV zK_tjgR{5hykf^NkCy^jqS>?|nLCUhqUqphuWtG2*#1i=aFOeXFS>cG4yi^agg)E)p~dcCwbB zOR$qv4+&ZYJ4yABNN+ny_eFxH!A{bBk;n!*NpK)R`(P&t4kWUIP7>Tmq!*qfxRFS^ zJ4tvVK}%sL2~Q-l)J{^nAd%*Rzb))D{38BC>4)-C`3=J-41YAPF+OhcnI2IL%C*YZ z%?a~<^Jgr~a*^eW)@jyH*nGCzY`?TGv47tYa$N2BtMh}d7S{(|KXcpN!|rc*%AQ-j zChz^;pQx?sM|_>WyL>PD=lh=v><{(^M}p6XmWA#Ly%8>kF9<&wX^k9<{3yCA`bhLA zF>7pR>|0Gsn;vRiM8C{@?vHv^O4MNvVrWj z>{qidG)vB7dl?-jCF46ytnf^ zU4gDeT|2w3?z*e%iEdN({O-HDU+US=^K9>d-dFp+)gSM_JJ0fO$$vV3av(Kub0Ji? zy71THrs7vihSIasdZ%4K?U&P!%vdtx@fm*|{Qk^GW_1s-p(C@+vwvCcF5fi=6iB^- zroKaZ9ev`{HOxFlbQ#UuAMksUo=no?3*?ji#e!#`n`e^!aqiC#bW7=E%GAX3LHy+J z^Wm(}H((s(bkf1;M0Q8A)e&i=I+Be@$0OO)VD%b)JUy5yHx(CVwUJ1+Tu$&4iG-F& z@Z*Vc0w2kpjcB8MtgNwUCKKhOs6LV!OlKDsn=;YS(FFeVgHA!GPRXM(2mORu5*#B> zT!{w(b19Qdxwy$c0eKJ4%KlsyrG*k9G@BQjc>p-&(*ArK_a~)C@2QU7!&hn_@i`xH z#(dIoUksVige&Dtj-6t0_i|ZY=8kVKmwCBbmd2#9d$cHj<(@KX`80zs7W47H)3vAA z-EKv3-(A-J=vB?FoVS`)FSn14m1}MNNwjqw+^YmBwgVc#TLE>-1bCacFEGfng@IDK zP#WTc+>;LYeM;UVqtTsGH!lnnODQLhOGC(ZbB-<`9BbDAaZz9ItL#}W%A`}-f#M+D zt3QAznsApv&n8REw@Pxa*koz)+`hssUH`l*WHb4iqVAY4H9g|&ojW@lACTs1BZTOa zlKTlhifXHH_UWl=YD+gcRMk;dBWh5(BNe~b<@uv8W;RFtzeH9W@kh;O2|e$QHu+4p zkjobI*K!0%{n=%>GzBuov=Eg~I zyjWiG=~Qsnu3+lZ(i7D(HOX^|@qn|{dBCWAI+Bf5pX-ga#_-{+*Aa*W9LWB@RwR8$ zOVG9aL^jnY(11|2I zR1uVdU+4yCgJKV-D{4>BpEJZu8B`dO0?izck4q-S*vJkh@rDv8HQkp&^XB{dAD4p1 zRwz!Z#p<+p-5c&7P(mS>?2CB$tozq`12&ffAG6oJ`tq>Z%DLCU9bPW|6zZ1y|0JH1?W1P6yuh@WJG zK{hGbn>R$|-ad!d=g41I&-5uvE=!n9l0g=CSiaDT8`wu2Uey_xJ|r%ejkug=Zr*Uu z5tEw$BFIbzhsSGNLST&2;dnwD14QKn$Qd*Zes`VhhnyB1dJeSFWuz^0qbCgl6&yM3 z;VH$4PSY7fe{mKcD56tnsDn`m`p#vtawDtuH=d}CC-4)Lx8-8mv$5PZUUu5F$1T=~ z_qbw1%b+D}%5iVRYSA9Iy{+lVrtwc_d_x=`>G_wmWnYWsaJnn|^3y=ug2 z{u3I3|4Ff-yPmhHrq|5XZ^WCL;>YN~N9joPjxqc_>4*5TLk9^%$6mumU;!Niy#pg4 z1dM^6(s)7y*+IjVT0<9HkYZ_~ZzW9ygP`L6VkxN~hd3_h#1H!eK2tJ9v<&g)GnIU% z4lXV#B=Mgo4&lEn!NZ`KN@78RZ$svxg#7OF>@EH;^rf`V5%b}T%(fr8inEK(#dJDk zoV~VeAEz?kyICyg5qpC(?|`dOuwRSQd#1Y_%9DU~)1Q7< zx=+7FY<96(8d95+A;l5%1e5&X{`7E5Uth~`y8j8gWtbj8Rg&>eI; zw3Ys#+%hZXjD%gWnJu@a`+pv!rz9ntHCal?d|3N_y1y^Y=^km9lq@E!Hoqt4Fojah zYLdtoiOHkV6VR;4f5$SZ9+1@#rvd3RrITQ+P7>pwzDpfo^bt%Caam2O z(nAg(m($bcOmC4TU)0Tw#kD(E7Yy8UPd0MCQe3rVRZ%%VlJ)VJU)thp;@U%<3v7S2 zEqKEx`BZ)%_c#-UM7)r2cx0cWZ+RE*UeV|9KM`r^UeeaKq`M_jecl(3`=sv_Iywqa zwi4A7)Rr~)gV3Iefc_uCsXArgl^x=cgc1Ze$tNx^`N#0RW+<%Lv9@UB?x;_aTc*#M zmX^6M;*pk44VrdG-->SDwY<;alRb_^Ar7>h9*GPYvTD%xI{>yFysHhCG-)4DPmHaVK zBz5%>J&69~X_MaZB!he=g&6M;4J!zoT%p##Q2t5fQfSm=`7f&TFT3gJf(1u!x@^95 z)laQnD?UGU`u$hA{M_H<=YjPt@s5soi+%Z5K6%(8c^y*RDy0`3oj?ER&2*@~!mS>k z$3m4a@wIq1oM;7DezyEwzLP%-@j*8@9Mt!m(ACa%Pri>&zll8Ex|pjj?U@tDYRMb z%b)$!VRH?^pUk@8;${B!&85E8eT!F)h1~d zEY@FJ)u?6ud`r|zN3Y1M*7?#0oc0sGqVIdb_Bekc-mX1nji^)w%Fz6I6Zv^!!cxFw z)2&3}bWmY@3giPoAfx3p7>z*zBmoz!K}rzH$0Vux;D=@TBQU~Ghg9476v6rwfc(-^ z1TPM%v{5!{D~$5eog`r8v1*_?K!I;_7n8VgRnA5CD>pN?Y<|9p@WyOs6%*$MkUx zS+xVaI7!}V(qpqZ{HGKX{&gJ|%nASfr6T>HV ze`(I9-B;gm@Bs(vqfcPy&AAhUPSl(UV zQ9ccPASCggSu1z;W*6kkX1`L-FUa=pUOCjw%~K&%LpJW4jFsg9hxB|poG{Nlc5u_G zp#eo1n6+y2!DDmH&Ed@QsZrfuYl!Oqnv5~-MdS~Ex5%x~BC`6dH_e7Gg>DQr zAtw)z1r}8G;R&_|$|qY+SCGLaP+&yU%;GXB%utkMAGv5IoHeza+^soV`uQ}I)8n@C zX$~uY14L83)1f-7$T(W^s>{ElnO~(Ldj@Kn_tcrGMPe_kJd5=d0&g9Slm`g zaayW>v^t>(Npti&MAUqXL)CUob6I0XzAKdC$&mKLQ1WjWkOd4l@kL(l8m>9mTwRc< zC00gHClzSix;dH$QmU^R7FQ5#Qny;OgrSuNsky8USyDsESZX@2{OtfK>X+cXL$9QsD1I1*B zcZO2h@d964{qST|YW|1AU}3V(Pji@a8N^)ITHxb{zj9ok6AGMhin1x|3C(c|jhNqY z;+0p!sZ^K_{Q8CyZEnK}_rhTqADBspc<;)do|PkXkj74&D2r?92IWa-T4K^^xpq13 zQLbH%dw^CU+u(B{oXKwPp_w$YRO>>FOyT5d=V$!hs2}t9O(1mRcvf3Dp5@*N4EXU0 z@F#NG$VC1OSpOh@S$5R4hPi-M=Nr(kp%uiTkj;i(qjS6g;w>a$YVMBwlv#;gxo^+R zS?z5JgV7amn3dZ%?bJ(V&D^t3`|!9E<6BeYWJhseESNM@ylwVap4f zHx3lFc@r+&sd8v{@^uMZnlNIfK_1Q3V`(-p7EE@-*9W$V_%ycTJfLjpn z1j5Z+DFr7X+sGtzl^kqEckkAQ)Q21am(h@DYbWIXuorkEv-d5#Hr{ULtM_hNpC4$= z+FS0luHLMl4CL2u(mq#r^18>Jyxd(YbJ+YL$G-lfvo0o_sWD#IvY}9D>5!xsyE>Pg zzp=Qd!*NB2p{1+iyroZ`zofHE`;>4Go$2}|Jr(loLD*hCn)MWD`o;yA-kqvbLZ|BX zE;+c+vy#LP@7PwFKE1SU$It7TE_LnR^*)m|95OnJa|(7D9MUGqiAk08+SNbz4ocH| z?P06c9#3bQ%{JNO^w#8-fTc~haV9!Jms)zql=PlB4MZ9K~1;H0Bv5{5FdwP3& zmaiJCXGYG1`$&GBYP5!GP#Z&Gn^9daotSi)etmfgOm3duV-Hy^IvRGHHRR|Utm*z= zhAx)VeWtJ*)c%$%R_Wsq_=v7rOB(6!{^vP7bq5c`{L`$);*P$i4Aq zme^YfDBuSG-)eIKUf0NvoGzDh^5G4$qqVE6)nTr-*K^X3rfAA~!}52(bpmDWewXz} z)Eqdx7{T8N9ry-^d1++r$lAzKv!fwfp1NHd8=9JrO$}z`sL{BNw1PyiV_Gv`-ZtEpz^Ru1ZX{>WK5WSGw+ysspUezM>|*$< zhp4LdEFGuLOKW&)dLlV3MN=!)pT?(k1aV6#hqIZ-$&j6$ zt@#q@nPjsMQ1ll~S7RLM{0GlB$!f_1KTWMHFvN4P7)TO=Ba`El<}eYYK*|BB2{emS zDhgu?!p0wfg5X3ck6a5_qt~LhZ{b_`m$Y5f?^{AC9}l*Lo9 zcQ(6J59jSoH@N~FbAO&-hs&v0xW$?DbcJS4N2tObkqm}XzfL4cW5+DNlAaIt2JCAFAU#&w``l)2HFKb*xA64#zGN!ujFB=aQ- z-_Dg6>oeKsCVsV(Kb-l)_imR=+Gk7_eDNhF3nuqznj6E&(10t&H6z+p2OG z@FucPr-VwT*&Ld(DM9fB5fW{|^_|1i7yZ)|1W}v>g;g(rObmhsr_#*!`=T5(c~Y!3 zU@~$s>5bWJZg%w~T@FiYqCKjbjby5Emzr!FES_gE2SQV!RNc;-T5+@1=$~w=BknNK z%(JsC+!=C)gFP`WsjiR{vqL^db3EgZa6Y5Es}257-3Lr`m(U|7roqF%Q;fiWiV*4D zK_Aec=os~!sTFg<7$=RGMtpTly{S5;B{Yk~y_OpBwQpZ7)W+3cs%N&JNeTZo72=Xg zhzBB)Ks;D)q$O$-O{Gdr&?+bHs^5MJtrG1;dil$`pUDHtWfl$()1$6~rK7m9EsE`1dnQzGRQFkbm3{l~+1vr@O9@&I8QRG0x`CzTpuA8DAq)`o2U7pkkJ-Jz~M#SB-Tb+K{WlMK= zrW`I);BV9i$M) zyUpNp`P8N)qOg%LIy?Xm+L&)K`-1_xc_c!UlYyY@bg7PREUBlAN5$CX>GAd}n~>86YgFJyTefumUS#F2O3Fo6w@B^tewJ(=EbF z`2SMdDiC9^;iWt{cCB$?F6qrJCEU*RjC6X&@L>Jk(Y2oq1iU_rB!et{5b z(G|q^>QjIav@`}_vZ-kbXtwh;$=%WtUv#;-;gAC1WenwrJ61Ft)j&y=~rtcM;Bw`M#BFHaGPJY;7|N$!V<!ph{F-xKQeIFY7gJBa#?rJpOS^??Y2N)Q*L_0 zG_|f@6Yg`M>5^U8IEy<4md5dMjTkHWpa61gY815hPk_vSF|rCk^mH#A z`6sTEXQM9?h@!)4Dh~e^@!6Vtq#jg|sSW&b=bZ?`^}{%vaIDJH!q$~nz3Zx#)_AQTupdYuTzTvd-Sdj~M0Z9kS6VONS7bF;-J!7A-hjE+1ad5!Y7IRs3J#9iQo0 zJutAkr@G33KmIQi|DgSw*D3Tn;j;%X6mX|$t<+hd2DEkf{5cW6H6@JS5Q@uxS!Zv( z7|=>nfTSHKKCMG=0-yoF@v(Xwy0M+O0q-wCC_#QB5;_pXxPv&ag=O%+_&j{nl=N52 zp%$4R_H0Y8OlhBj&4f?}ex;qee4*x$_IG<*F!&p7KKXL^*K7UrpfslI-cg-qrqH_; zlo=s5EtvJsWt8!U4(Ph{SQTcOcu*!jl_b-VqPq5cb2M%8S#kHW4F!y+JGLO+6D;Zeb?RTerK98_S7f-|8Mf%s?# z8siZ3L$c19Lt;0S1l5}inVX?IA zhP4*CEZcV9yLrxN;Q^almb`9*W6wRGTfh2-mTZ;gRqE424f86eejq<4XVAkGQ$=V3 zA*dCEkdCH~km|%(IBhzJe{0LVdu*1V!OnG{*KXMSft@ycvia>Bw_K{O-@Ddlw1h(@ zdkt!v9JcSecgvi&5@-gl2JHZC^R6u$-`AILWsfm%qRjGosu5Q)Gc9*L*Xhxw=xAON0!-`G+G_?raD9Xj!WO_4v4kj*=-2DUOcsl2%xbl+#UO^oh=nw_FJ3{v)3q!1Pt1eLEmSgd zCjEB1#bM!Yj|*xJE&?4{bXh>~TOsW_!GUP!fQ9f4>b~}I@Ja+V%Jyj@^2fhBU<27X5{sj(z~8Ro&)wL`(A#F9T7x4B+R z2y0OKq`=`0y1J^j2<0TbwaUrhoH@bd=e4)~Y%iL)8~fASlG)1DcfG7+)D6J>GhDKeu1zUZVc!At%IpA)r-qxJ;dQWn;MD%{}0DuN$H zVkahoeD|L$UoyKdT|JrZn|+Ctod_M)emwhaokjvCbB`j9)-U zx*3KClBzo?bongN%B7y=-F9>Jq}krRyyv6~d^0XAPXbrx zufLK{$PvipPTdw(Fh?tlUh{gJ?!Cl`t2zHN0YveFK54NJ(<+R@Q!Ibv~}4ayRlRa`=a>zd>7=5-d? zdCb|_tliw)>3plrgvD!L_r*-r_u9Ow(th}GI~h5xdk^nzwH&je=)65UckVgQLJ|Ax zj~zL3Y`sPAgOl?2vonQW#t2X(AH zSZ7-t94wNdHhaN>*%s+L)!ml|xMJYPjHbY6EmztE{*FAx`Mu!;K znb5G{Aq>hHmFA!u{ftuZvt*6Zp&wCTs^d;DmyuJ9vYd`ja`K2uLliw;ix?jhEbIxP z?9{%-cy$h!o+%@qd~Q7$T<@zBGQsN7Bfp{RfWb}zpdKPX3@TSgf#wPtC+_6thR19F zF%I%C1-wo`&aqH!9B4Vw2uAg|0Qhu|u5pS9gc|jh@an3~4q8mmu zG(i1*7yvXN^7^QNEiddeSWOrqeIO|+@av^hx;2N&6a-hu%mCp?PQ_q$yF#m4gSogX z*ypr3xZ4?Svxh8Jd&p&W;-uj>i^*!YN)d|wY*54a8)8yMyWQ$hU0BqYRg=w%!RwHX zs%me}sR_4%)EO+7Y0ml*3B~Af$_B4$kMjVW`!@bd-K*KCt`X0uwTTNJ7m_BY^_a0P zOL$U*v=sB?lC6go36m>NDxmVyfqPHJ}Wt`BhjFf=s=)1s$#%Dn^^qcts17oS?!q{Ha-LG>8o> zoI>-Xe@~nJbONxq_4sj*$rRu+`9#&` z37SGhA4o-~sbvlE;u9nyz3j9`Ixv2yuNRwDqoXHc^VuWa4x?&WY{$}GyVceiwmO~G zaHq|RQ-gi61=YIsYCWiCUQE>Cu-H2yR%f|RSF%0muai~SWp>Ei3%c@!5U4$wtc(VG z$Oo$Oa@k>aMx2UMCSvsm?Q)$~wXw!{_3>zXL3_WJS4e+>#y%afjORg;!RXCk3}?uj z3z4k5cCjGRNP)q1C$ABtQ`ha}aduRG5c5gD&Vxlysl#sMv zdD?>dS+Xm|V^|xBQY?^!o4zZV)QaMpe-{r;#2VTof3E=diJasV(d(XAh785XumlVi*&a@ zqBA{#gn-t2+&2!b#r`mWCSV`2n}DUB2TU|)^Q!z6Ie<97t+XE!rc0p^;)7}VG&pGr zJ`a(UJ_y2GcD9TV0|*0`l*cN0NuQ6yKtxA?MK*q8Av=l9T%L@0D3`FS(&NqqM2Sd; z#ai)Tv#Ys%sBLzep4xF1#L{r%0ht>lQ}u7b7UhtI8x5x1jAkAiP!S=a4opXcI%Y6y z-)g=oF(YR(7`ZGN4=F8e)zNYyD7_n2*N?bt_&uf@TsCJy*8v{X?J>lqsY7* z_5ZJ?NGMiH@*vE5f3WeGD#bz(#cunZKdNofKF1enPk<Yp=FrzjP+Y+qI*cLW6*O0ah-QLN-@*j4 z22LXaio^+R=isDuE4sjf>;dFt@?aX7#1lc^tt$ycqY_&R{`c5bs@u?XcW5AVcay=b zUiBDQ>r%Vlcp7$c*k`lo*ja48uzUt~(x>hT#SP&rz5S8LRyZ6h9*gvQuM8XFp+7rp z&syw2$rY+$tu_msn^l2vC^(LBjn+h;5WW}uk7A7FKBu=)oH{rEKiU*dyLx)-)o8== zKhsLwVLh!$1tGyy7y98V^3&2uX!k9QQFs8XKyu@!_2Bq!sen)eDkrU7n;9fq9D4)e-agzafxnL{-G@U8+5*dQvm8Z5FrDqWBS~7Yn-sye&SoeQpPw|1?hP@cj+6s}J z&>N_K;Ix^5jRGsqDWpn=RR`zW!qC(MEB<-B6p+y4acigmpN4odAAB5dIz~ipbX{UT zoM;{@y&fZSPN+;BBl6EtsostV5yXigh;dgvIOEO5h$wYP0X4SgIeU!AyG5fl|Dza@ zFA!XCo7c~>Tl(%y1-f!cA-OJ*#THFoj|nwU zZVh|5S#!~rD?%Q=EdL99fGXy_Xk{e%%q1T-SkVQU?p>+P&?8cKTu9WT(^Y~9V(3Kd-OKCS^xYk8#iv5-(M)l6Ej!rzv!a6hER0Dvr}Rt<`HI8laxmm7jmII_@0f8qYC|QMcbFcmwVBbIy>^V)BND zfjM-Js=?g>_tEjjvi{b6j$ESpm4*hi{LWqDgYS^Gpbar{>(F4zzCI@S`{Vu>@F?pG zu#)+wsQI;}{;enjrN4lH@=xi+dcJ?WKPZm>Y-E^%({OZ#Zm{{+t#^fBkn^oy!ne^|;poA%Y9^<}}pkaUi8 zQ-hm!jj92T9reyFBvyMsM}}snF4CUX<+Fn6P#rdNNCPd-#PM@N1YQbfcCiZTw4+W#0)vlCnU(7rw<{s}zmwb!V%U-Nojvuvi!N#ZQ8s(GB(uD?xsi1t#>Kyc^C z=R((l)tjVC92V`rxK*Pj`}MCa-W^u1G}$z|->bjIZEE~2!G9;7U*~TVBo@I_0QajW ziE3W+eqMc5&xk^m`X5B_s&q5P9F|@R4oQw4-IE0=?Bsc!a0x7O3+YAt=ML-hs`@-_ zLt-?VzV|)aQSN7Y+4uCR=jWfNxw zj3yu8l>#HB*3=zPWcQy|B%4W%dj9(sprt>>T02MEigW%B(!~Ir8H|dcwf>=2Kn3g*pl&OIv z)CK;Fq!H-q6z9>Px?-?dgsKr~?=f^BhTNBo& z36hU~6#cF9F|=_~`hmXIhxTn`c+7;QqT)fd79S!%Ci*>x*dO3bt`)NA1s8h3Vfog# z=y5OE61JDn2JRPs*8orrE(aCySObm^bXwyGQyo=6fq6b9_>}Qa{@-YUApei zvRVE!h?xIYG1jh;ol;!CMuifs2K0aw?);0a$bZ46JDQ4#1p^Ptvi56(-ClprkEKh* zbD*MObs?d{pXLG7dX=8D_b;IEzZhT}{MJ-|j->HF(=}0AfPiI{ss@&nI3H9c>&B$D$>H{W(mr#a#`mqq4r z)|3F&ZfQu4%h2o*I9=?PoN`>k3<$*o(0Z12_a2*RIq!ytKl=W??G7mraY^>RL-#&( z^Lpoux7_#OJX^$VuobRN%)jcvkA2`!zh}*jkFImL41UL|doQ2vU4Pp{A2`$<>optv z5pxcDvM$q}m+!~g-zeD>nH(Oa2MRV=7Da68fw?k%+TI_!VlBV-Bg3IkFm%)QE!%h8 zl}xzZS8v(0eb$A;*Tv}*xoUoQ9iP8WZTw}cgJF??}lxgx9_+&leXCh zAEy`>{`s|&>e59t=0(iF$K)V#s;=!!F(-o6HCZqqZ0Zw$izSX-PDxe61fTQ^L?O7U zKle3ZTgnz82YO4i+8^&Q{NQ10aNMm$a@;k(R!m-&9XG}cUg(kzbINR^flM3RBE|=eR+Gq5%bDUC>f@Nd>rU%ikwEyl*M9FSNw6E}a3o57RIa&s#HhRM0 zAf?fetT&pzhql-YMO=(1JQA{0jV=y0h}?%ASk?3h(ZeG)xB7!evjsGf+x933f!|F> z$D=5Zs0D1->$ZJ}3OQMAwshgdYlSyA=LE^SP}h1sGarqe|9}0r0cUD z;46(MaMZu)U-&yIvf~N;@B{?~(Sct*MWHrxio&PRs$`6buYLGJ47O8z?VWTcjnyBc z$B5LQRi3g`OH5gOh3e?TP3iEX30`=Y>L8nt4#<`%i^Gq+PEptC{qaOyqFv(cwBI|! zngM#d1)?9-Leh^NRdvqZ7~I&wiF}D3u>p}DS^*C~xB{j=Mey+$mh`4V)jx((*zN9C zIu4hAoSQy9_v0Vyt6(~QOv9NX*bwI|jh3&uf$CI`>hcgIF|(*P=kq3}my?$neZ<+hz`n zV|iNp;-0+4XUX?0Zl5;k1bfGc3vu-rT{%E%9w8-vN-BUyCdWP3XDrQt7KYFy-Nw}W z3Cc2z9BelR6~k0&JegEYVuzlauNc&jdB)?z=wBlwuD>;>+<#MS6B?LkY)4k zs1mVVWHY)VwtY6^#RiAtDo0SU)A8+Q$vR?-fCO2^NNqM}8ghs7yROz^-5BYM=uLAl%g8_@gN>(&fzj)DXwa+U;nX>>0`OgwQRKA9 zQCOcz2^LEf?SNTVS)YHxsyE$empW(e@2I^7WahnVoZqCOZ=~0iv~+!W*+?3GB^yL!ZxLkng7R7eM(k+=7-401C!G#kTVgQm67RcldXlY!rKLW+grdow z&)>iG@V?}t^gN&0ga}=eCEvGf#g{&N(@^z%LA-yrW2+yPuy?hEy27qVpf{TJN3rz} zHoM6NqtiCE!K|+H`|D)`e3wo7Tc}`4(jtVqDH_e zpx@?TEiot$xvZ1k^`MVVE*6ravuGWVE_W%Y2yPX9c7k*i{ENL%3j;YF`K)|>)4pMQ z81EDs+!!{7LN;wrANKV%_VzAYvDLX@*?HYP207o~bH)0jJ4cGs42EgNjhioW>$B9d z_K?{Ylp>1`r%dKh*wi#K%Wk!XzNh^n)w^Zc(#~!}PxpDtHY|SoKwoM8;EbJnj$X8R zBkn>77*c_9_Zd1Y?;E+rGavx!uj=W`5v)3-)#= z$Nl{eAUC^wRCoFiP&27#MrZ2!gTUhsj-In1{AK(sK>v;ji7z~@u zO>VQ|2*OHJ#@k-RLDBo2W{Ex6&sCpBEELHVL^4mTE)0qV0flp%VR^l#W55F?l#Wpy z(Q}+=(VmAkijC8v;_I7wr@-Y&cFYNR1Y^|$y&$8%A7FZIlhwMQD98jVYykwtcT2ef z@14%MM<2_G0|b@H@(5NsjW5lb!wXvm?Onw#`}9o(nKx@E(z^$hf#CsVaCaKBnox?O z)j9g|tY`S_Lo2<(SS;u{|KgcW?S!_2|EYi2lkDtFdWQQoTAn>VrzPfOJN12@&)JfZ zgNlrI!%^Tjh2GLmkLPH(eDKy=o9rI$wp+|E+H5bH&(%)(w|)C~o7=8^&h9onVvd;~ z!Pq6#JxoH;816~t>^p4zrG-9}q!emFc&JAtb8 zlST8we$rt4ldswcy~l1am^Oyz{bvmK#Vkc%!0irvC@^a#?u(l*(_eM8jPBW%-ntDp zj{Q9ru4iMoE3WbT-ERMf$FJF7qUkF)?n-+M!dpKnPK@51wh`|=K8$xj-$d`&K6ks- zD0rJ5IhQ|&{F|+>fagz4-<(qvqxRkLHPie5VNUzUKTrHRpl>$ez)PrV+h+aqkjUTH zUvqf2@6ogUP%r;I_%c2;9_zA5j7N$KC73f1fy!828aOZcvBVA$HJJga#)njyAaDmy~ z!|${Mg6vEzr4KWIqhiyb~os=w6kyD=X16^aq} zfYo4@@q9_{g@6d9cd6u%gQB#K!p6 zXxdFdpDy<_VB|7~`g3lhWN|wr#a~+ZE`wS1S&+nBgXkj@EUPd)2AFGrLgUYO!x+Tm z49pGeE0t0LLCgkb#XDV28&+zPs$unm6O%VN#4wOOi5?=eQyG%*_SI66)|b+@WqzMz zYAHU&i@ywq0*O>}7oQc&lv9q#LuWSm7VYI?CfsSiD6qHO(>60VXqQxFU|u8<4q2zK z?6yZEiBQrP^o9A!o|bg)CkxG>25*V?dPCFWA%E!K&ul_%sHH#TpS2_qpBv9v(~j-a zY_UMJb77m^j76G>czajDL(wfYxhp}(GQm$|!=4o>c(Z30n4?H_b2Ot5)&n_{v+(Y{zgcXv5r{=@93K z9rjGxWH#LxyV7FzN9>1fR^=Jn#j&8(;&&<70NP-^$Y$X72h56bC)G9EZ;V}Gwoq00 zl%KH&x%`05awFhiEV|XRsGeuk9`mjwMf68|y`*Dk6c&BZJ6|g8+W5{C< zJZ$&Y?rk;qST2giYv5_WMQywJM*E67T(LounP5SU_+wucdZVCQANFbm#gfr{I$e?x z*hfLEXeVk$ByxXH<0>YYZX_sXa})Zm&s}WyxapnGr92X9nA)`OFrql03~Q6K|&YHn!*tgd$#($?BG6x7B3wMnZv5 z2z%vwf>0uTs|Th{%db)MVeI*eu}SX}5jcwdW5}a79lJ~J)<>u?oPzbql3abS+6g!8 z)WirKSt)_Ku;&RJKEW)_y})oa8H3b5bvHk~(TU%LNrj-t^Q6UQ^VsdfHjf92?Zs(e;Ear}dZ6*sA9`|Lu?F-x67p_{^;dM)9x=YZ5*MZS( zmU-}mpl6qO2LITZbX2V>SOlD3)V{DSIU^&Hfvoa!cg&KWwQyECJ*%ZD79O{S5|}N$ zfV~s5g$&FH{s!{Z!N&#vSAaZt@IR0@k9L=wIBS?eB!3|6QSyq>YYr#QC^lir234@x z6(|YhqesB#yiVVU1^3Wh5P3{PX~grV3^-v>@yhpjAnV70g-G*T!$-Rj~KkPmzx)vi9*FNO;-5* zXZF><8)TOx8_X`m6M@VP=BB1d(q>QhC@5)w1*Iga)qx+%kmcynDS1% z&h#`=&IrAP9cKhP-{-co~s2ku$`N7o#g{_2QN(h0fAel0lYxLXfYsgEH>xB zl-%SV8<(58QSO!{voW^3v$UnqmD?{FGPoO;cAEKvoqfeE#Tq_8lRt*|sCo2m0&?%u zKY7S%l9|>Ll+uNKK|#v<^L~ZGyPyCleL>n^h;#v*>oks~5?E-C>&e?CoRJi;n9EAL zq5pV8{97@;2OYKWLg8 zC`u-ah!~NFpO`&b%fmO!K2^)h$kX22RNsL7cWZeg3$XvFo~9FZ7j>z z&pWbb$I(5z6FaX=?Avwlzy${n9KGPOeZ%-#wdcai_U|}SJF9)I+jHd7eFqOD`nr2- zB@6c)*mIb?rjdkLMEv38W*q&n3v!A=v{M_M* zH=P&-v`W60_wjz7M~q>C7kPtTFXsFCCHw$C$Pe+u{0P64AB7rvj9<>L;8*gu@T>UM{2G2Oe=8s5*YWH54g78V z?ff15M*dEI6Tg|?!f)m8!cykj`5pY-{7(KJ{$Bn*eiwf~zng!6e~{n9@5NiU@8=Kj zq&6&xx*H6N0|KrtM-(Z5joyVc zC^VE6-d#L&l56{PPQ{V!zeO7(e9%^E4`u?T0>(HyxBVr&1Wi{(jv9aY*9>xt9wgTM z4}HvFHwi)U{&2BL!cLRMn_b0s37&pS-Rn;xC^d0ZQ_vs{#Hg3|;{xov)9{sYFzHY7 zRn}~Edh@pU&`G-No#oxG;*JV}38%WSr$MEYD2C}{fjJv0BeUUR&7!Rm#qhpZ(fFEP zkXYSb3(^!cY4xc@S8=0Br9?5DHEH|Osit%liw&1tk1R+Sy`4uEG#Do#k%&DmP(z7r zq8O%P2W_gOpnj(Zg(u$6l|9q$W^K-^D{gidP!z)v{a!11+uxIQNuO`sRouFuFpO+# zxYsh}fcJCd%`sxiwL&e!Hm=m4BU_GW;_AF8hN*}N!s#G16uN?0rkL>ah!s<(pO4iP z)KlYIZJ+mZt%rD%95=l%KWk9rD zDV4T^B(1RuLK7v}?mI}QusgueTnYL@qF{E+RykV3xs G8}}bLsapyF literal 0 HcmV?d00001 diff --git a/components/firstui/fui-icon/fui-icon.vue b/components/firstui/fui-icon/fui-icon.vue new file mode 100644 index 0000000..25053f3 --- /dev/null +++ b/components/firstui/fui-icon/fui-icon.vue @@ -0,0 +1,148 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-image-cropper/bindingx.js b/components/firstui/fui-image-cropper/bindingx.js new file mode 100644 index 0000000..c9087aa --- /dev/null +++ b/components/firstui/fui-image-cropper/bindingx.js @@ -0,0 +1,282 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 614 0 72 5 49,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +// #ifdef APP-NVUE +const animation = uni.requireNativePlugin('animation'); +export default { + watch: { + width(val) { + this.canvasWidth = Number(val); + }, + height(val) { + this.canvasHeight = Number(val); + }, + changeval(val) { + this.$nextTick(() => { + setTimeout(() => { + this.valsChange(val) + }, 50) + }) + }, + src(val) { + this.$nextTick(() => { + if (val) { + setTimeout(() => { + this.ref = this.getEl(this.$refs['fui_cropper_img']) + this.realRef = this.getEl(this.$refs['fui_cropper_real']) + }, 50) + } + }) + } + }, + data() { + return { + touchRelative: [{ + x: 0, + y: 0 + }], + hypotenuseLength: 0, + flagEndTouch: false, + canvasWidth: 0, + canvasHeight: 0 + } + }, + created() { + this.ref = null; + this.realRef = null; + this.canvasWidth = Number(this.width); + this.canvasHeight = Number(this.height); + }, + methods: { + cutDetectionPosition() { + var windowHeight = this.windowHeight, + windowWidth = this.windowWidth; + + var cutDetectionPositionTop = () => { + if (this.cutY < 0) { + this.cutY = 0; + } + if (this.cutY > windowHeight - this.canvasHeight) { + this.cutY = windowHeight - this.canvasHeight; + } + } + + var cutDetectionPositionLeft = () => { + if (this.cutX < 0) { + this.cutX = 0; + } + if (this.cutX > windowWidth - this.canvasWidth) { + this.cutX = windowWidth - this.canvasWidth; + } + } + if (this.cutY == null && this.cutX == null) { + var cutY = (windowHeight - this.canvasHeight) * 0.5; + var cutX = (windowWidth - this.canvasWidth) * 0.5; + this.cutY = cutY; + this.cutX = cutX; + } else if (this.cutY != null && this.cutX != null) { + cutDetectionPositionTop(); + cutDetectionPositionLeft(); + } else if (this.cutY != null && this.cutX == null) { + cutDetectionPositionTop(); + this.cutX = (windowWidth - this.canvasWidth) / 2; + } else if (this.cutY == null && this.cutX != null) { + cutDetectionPositionLeft(); + this.cutY = (windowHeight - this.canvasHeight) / 2; + } + }, + imgMarginDetectionPosition(scale, delay) { + var left = this.imgLeft; + var top = this.imgTop; + scale = 1 // scale || this.scale; + var imgWidth = this.imgWidth; + var imgHeight = this.imgHeight; + if ((this.angle / 90) % 2) { + imgWidth = this.imgHeight; + imgHeight = this.imgWidth; + } + left = this.cutX + (imgWidth * scale) / 2 >= left ? left : this.cutX + (imgWidth * scale) / 2; + left = this.cutX + this.canvasWidth - (imgWidth * scale) / 2 <= left ? left : this.cutX + this.canvasWidth - + (imgWidth * scale) / 2; + top = this.cutY + (imgHeight * scale) / 2 >= top ? top : this.cutY + (imgHeight * scale) / 2; + top = this.cutY + this.canvasHeight - (imgHeight * scale) / 2 <= top ? top : this.cutY + this.canvasHeight - + (imgHeight * scale) / 2; + + this.imgLeft = left; + this.imgTop = top; + this.scale = scale; + if (!delay || delay === 'undefined') { + this._animation() + } + }, + imgMarginDetectionScale(scale, delay) { + scale = 1 //scale || this.scale; + var imgWidth = this.imgWidth; + var imgHeight = this.imgHeight; + if ((this.angle / 90) % 2) { + imgWidth = this.imgHeight; + imgHeight = this.imgWidth; + } + if (imgWidth * scale < this.canvasWidth) { + scale = this.canvasWidth / imgWidth; + } + if (imgHeight * scale < this.canvasHeight) { + scale = Math.max(scale, this.canvasHeight / imgHeight); + } + this.imgMarginDetectionPosition(scale, delay); + }, + computeCutSize() { + if (this.canvasWidth > this.windowWidth) { + this.canvasWidth = this.windowWidth; + } else if (this.canvasWidth + this.cutX > this.windowWidth) { + this.cutX = this.windowWidth - this.cutX; + } + if (this.canvasHeight > this.windowHeight) { + this.canvasHeight = this.windowHeight; + } else if (this.canvasHeight + this.cutY > this.windowHeight) { + this.cutY = this.windowHeight - this.cutY; + } + }, + setCutCenter() { + var cutY = (this.windowHeight - this.canvasHeight) * 0.5; + var cutX = (this.windowWidth - this.canvasWidth) * 0.5; + this.imgTop = this.imgTop - this.cutY + cutY; + this.cutY = cutY; + this.imgLeft = this.imgLeft - this.cutX + cutX; + this.cutX = cutX; + this.cutDetectionPosition() + this._animation() + }, + imageReset() { + this.scale = 1; + this.angle = 0; + this._animation() + }, + getEl(el) { + return el.ref || el[0].ref; + }, + _animation() { + if (!this.ref || !this.realRef) return + var x = this.imgLeft - this.imgWidth / 2; + var y = this.imgTop - this.imgHeight / 2; + animation.transition(this.realRef, { + styles: { + //暂时去除缩放功能,此功能后期做优化再放出使用 + // transform: `translate(${x}px,${y}px) scale(${this.scale}) rotate(${this.angle}deg)` + transform: `translate(${x}px,${y}px) rotate(${this.angle}deg)` + }, + duration: this.ani ? 250 : 0, + timingFunction: 'linear', + needLayout: false, + delay: 0 + }); + animation.transition(this.ref, { + styles: { + transform: `translate(${x}px,${y}px) rotate(${this.angle}deg)` + }, + duration: this.ani ? 250 : 0, + timingFunction: 'linear', + needLayout: false, + delay: 0 + }); + }, + touchstart(e) { + var touch = e.touches || e.changedTouches + this.flagEndTouch = false; + //暂时放弃双指操作,待后期优化 + if (touch.length == 1 && true) { + this.touchRelative[0] = { + x: touch[0].screenX - this.imgLeft, + y: touch[0].screenY - this.imgTop + }; + } else { + var width = Math.abs(touch[0].screenX - touch[1].screenX); + var height = Math.abs(touch[0].screenY - touch[1].screenY); + this.touchRelative = [{ + x: touch[0].screenX - this.imgLeft, + y: touch[0].screenY - this.imgTop + }, + { + x: touch[1].screenX - this.imgLeft, + y: touch[1].screenY - this.imgTop + } + ]; + this.hypotenuseLength = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)); + } + }, + touchmove(e) { + var touch = e.touches || e.changedTouches + if (this.flagEndTouch || touch.length > 1 || !this.src) return; + this.moveDuring(); + //暂时放弃双指操作,待后期优化 + if (touch.length == 1 && true) { + var left = touch[0].screenX - this.touchRelative[0].x, + top = touch[0].screenY - this.touchRelative[0].y; + this.imgLeft = left; + this.imgTop = top; + this._animation() + this.imgMarginDetectionPosition(); + } else { + var width = Math.abs(touch[0].screenX - touch[1].screenX), + height = Math.abs(touch[0].screenY - touch[1].screenY), + hypotenuse = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)), + scale = this.scale * (hypotenuse / this.hypotenuseLength), + current_deg = 0; + scale = scale <= 0.5 ? 0.5 : scale; + scale = scale >= 2 ? 2 : scale; + this.imgMarginDetectionScale(scale, true); + var touchRelative = [{ + x: touch[0].screenX - this.imgLeft, + y: touch[0].screenY - this.imgTop + }, + { + x: touch[1].screenX - this.imgLeft, + y: touch[1].screenY - this.imgTop + } + ]; + this.touchRelative = touchRelative; + this.hypotenuseLength = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)); + this.angle = this.angle + current_deg; + this._animation() + } + }, + touchend(e) { + this.flagEndTouch = true; + this.moveStop(); + }, + valsChange(val) { + if (val) { + var params = val.split('_') + var type = Number(params[0]) + if (type == 3) { + this._animation() + } + switch (type) { + case 1: + this.setCutCenter(); + this.computeCutSize(); + this.cutDetectionPosition(); + break; + case 2: + this.setCutCenter(); + break; + case 3: + this.imgMarginDetectionScale() + break; + case 4: + this.imageReset(); + break; + case 5: + this.setCutCenter(); + break; + default: + break; + } + } + } + } +} + +// #endif + +// #ifndef APP-NVUE +export default {} +// #endif \ No newline at end of file diff --git a/components/firstui/fui-image-cropper/fui-image-cropper.vue b/components/firstui/fui-image-cropper/fui-image-cropper.vue new file mode 100644 index 0000000..64b7095 --- /dev/null +++ b/components/firstui/fui-image-cropper/fui-image-cropper.vue @@ -0,0 +1,677 @@ + + + + + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-image-cropper/index.wxs b/components/firstui/fui-image-cropper/index.wxs new file mode 100644 index 0000000..c41d00c --- /dev/null +++ b/components/firstui/fui-image-cropper/index.wxs @@ -0,0 +1,342 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号:18 614 072 549,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +function isPC() { + if (typeof navigator !== 'object') return false; + var userAgentInfo = navigator.userAgent; + var Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; + var flag = true; + for (var v = 0; v < Agents.length - 1; v++) { + if (userAgentInfo.indexOf(Agents[v]) > 0) { + flag = false; + break; + } + } + return flag; +} +var isH5 = false +if (typeof window === 'object') isH5 = true +var cropper = { + cutX: 0, + cutY: 0, + touchRelative: [{ + x: 0, + y: 0 + }], + hypotenuseLength: 0, + flagEndTouch: false, + canvasWidth: 0, + canvasHeight: 0, + imgWidth: 0, + imgHeight: 0, + scale: 1, + angle: 0, + imgTop: 0, + imgLeft: 0, + windowHeight: 0, + windowWidth: 0, + init: true +} + +function touchstart(e, ins) { + var touch = null + if (isH5 && isPC()) { + touch = [e]; + } else { + touch = e.touches || e.changedTouches + } + cropper.flagEndTouch = false; + if (touch.length == 1) { + cropper.touchRelative[0] = { + x: touch[0].pageX - cropper.imgLeft, + y: touch[0].pageY - cropper.imgTop + }; + } else { + var width = Math.abs(touch[0].pageX - touch[1].pageX); + var height = Math.abs(touch[0].pageY - touch[1].pageY); + cropper.touchRelative = [{ + x: touch[0].pageX - cropper.imgLeft, + y: touch[0].pageY - cropper.imgTop + }, + { + x: touch[1].pageX - cropper.imgLeft, + y: touch[1].pageY - cropper.imgTop + } + ]; + cropper.hypotenuseLength = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)); + } + +} + +function moveDuring(ins) { + if (!ins) return; + ins.callMethod('moveDuring') +} + +function moveStop(ins) { + if (!ins) return; + ins.callMethod('moveStop') +}; + +function setCutCenter(ins) { + var cutY = (cropper.windowHeight - cropper.canvasHeight) * 0.5; + var cutX = (cropper.windowWidth - cropper.canvasWidth) * 0.5; + cropper.imgTop = cropper.imgTop - cropper.cutY + cutY; + cropper.cutY = cutY; + cropper.imgLeft = cropper.imgLeft - cropper.cutX + cutX; + cropper.cutX = cutX; + cutDetectionPosition(ins) + imgTransform(ins) + updateData(ins) +} + +function touchmove(e, ins) { + if (e.preventDefault) { + e.preventDefault() + } + var touch = null + if (isH5 && isPC()) { + touch = [e]; + } else { + touch = e.touches || e.changedTouches + } + if (cropper.flagEndTouch) return; + moveDuring(ins); + if (touch.length == 1) { + var left = touch[0].pageX - cropper.touchRelative[0].x, + top = touch[0].pageY - cropper.touchRelative[0].y; + cropper.imgLeft = left; + cropper.imgTop = top; + imgTransform(ins); + imgMarginDetectionPosition(ins); + } else { + var res = e.instance.getDataset(); + var width = Math.abs(touch[0].pageX - touch[1].pageX), + height = Math.abs(touch[0].pageY - touch[1].pageY), + hypotenuse = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)), + scale = cropper.scale * (hypotenuse / cropper.hypotenuseLength), + current_deg = 0; + scale = scale <= 0.5 ? 0.5 : scale; + scale = scale >= 2 ? 2 : scale; + cropper.scale = scale; + imgMarginDetectionScale(ins, true); + var touchRelative = [{ + x: touch[0].pageX - cropper.imgLeft, + y: touch[0].pageY - cropper.imgTop + }, + { + x: touch[1].pageX - cropper.imgLeft, + y: touch[1].pageY - cropper.imgTop + } + ]; + cropper.touchRelative = touchRelative; + cropper.hypotenuseLength = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)); + cropper.angle = cropper.angle + current_deg; + imgTransform(ins); + } +} + +function touchend(e, ins) { + cropper.flagEndTouch = true; + moveStop(ins); + updateData(ins) +} + +function cutDetectionPosition(ins) { + var windowHeight = cropper.windowHeight, + windowWidth = cropper.windowWidth; + + var cutDetectionPositionTop = function() { + if (cropper.cutY < 0) { + cropper.cutY = 0; + } + if (cropper.cutY > windowHeight - cropper.canvasHeight) { + cropper.cutY = windowHeight - cropper.canvasHeight; + } + } + + var cutDetectionPositionLeft = function() { + if (cropper.cutX < 0) { + cropper.cutX = 0; + } + if (cropper.cutX > windowWidth - cropper.canvasWidth) { + cropper.cutX = windowWidth - cropper.canvasWidth; + } + } + if (cropper.cutY == null && cropper.cutX == null) { + var cutY = (windowHeight - cropper.canvasHeight) * 0.5; + var cutX = (windowWidth - cropper.canvasWidth) * 0.5; + cropper.cutY = cutY; + cropper.cutX = cutX; + } else if (cropper.cutY != null && cropper.cutX != null) { + cutDetectionPositionTop(); + cutDetectionPositionLeft(); + } else if (cropper.cutY != null && cropper.cutX == null) { + cutDetectionPositionTop(); + cropper.cutX = (windowWidth - cropper.canvasWidth) / 2; + } else if (cropper.cutY == null && cropper.cutX != null) { + cutDetectionPositionLeft(); + cropper.cutY = (windowHeight - cropper.canvasHeight) / 2; + } +} + +function imgMarginDetectionScale(ins, delay) { + var scale = cropper.scale; + var imgWidth = cropper.imgWidth; + var imgHeight = cropper.imgHeight; + if ((cropper.angle / 90) % 2) { + imgWidth = cropper.imgHeight; + imgHeight = cropper.imgWidth; + } + if (imgWidth * scale < cropper.canvasWidth) { + scale = cropper.canvasWidth / imgWidth; + } + if (imgHeight * scale < cropper.canvasHeight) { + scale = Math.max(scale, cropper.canvasHeight / imgHeight); + } + imgMarginDetectionPosition(ins, scale, delay); +} + +function imgMarginDetectionPosition(ins, scale, delay) { + var left = cropper.imgLeft; + var top = cropper.imgTop; + scale = scale || cropper.scale; + var imgWidth = cropper.imgWidth; + var imgHeight = cropper.imgHeight; + if ((cropper.angle / 90) % 2) { + imgWidth = cropper.imgHeight; + imgHeight = cropper.imgWidth; + } + left = cropper.cutX + (imgWidth * scale) / 2 >= left ? left : cropper.cutX + (imgWidth * scale) / 2; + left = cropper.cutX + cropper.canvasWidth - (imgWidth * scale) / 2 <= left ? left : cropper.cutX + cropper + .canvasWidth - + (imgWidth * scale) / 2; + top = cropper.cutY + (imgHeight * scale) / 2 >= top ? top : cropper.cutY + (imgHeight * scale) / 2; + top = cropper.cutY + cropper.canvasHeight - (imgHeight * scale) / 2 <= top ? top : cropper.cutY + cropper + .canvasHeight - + (imgHeight * scale) / 2; + + cropper.imgLeft = left; + cropper.imgTop = top; + cropper.scale = scale; + if (!delay || delay === 'null') { + imgTransform(ins); + } +} + +function computeCutSize(ins) { + if (cropper.canvasWidth > cropper.windowWidth) { + cropper.canvasWidth = cropper.windowWidth; + } else if (cropper.canvasWidth + cropper.cutX > cropper.windowWidth) { + cropper.cutX = cropper.windowWidth - cropper.cutX; + } + if (cropper.canvasHeight > cropper.windowHeight) { + cropper.canvasHeight = cropper.windowHeight; + } else if (cropper.canvasHeight + cropper.cutY > cropper.windowHeight) { + cropper.cutY = cropper.windowHeight - cropper.cutY; + } +} + +function imgTransform(ins) { + var owner = ins.selectComponent('.fui-cropper__img') + if (!owner) return + var x = cropper.imgLeft - cropper.imgWidth / 2; + var y = cropper.imgTop - cropper.imgHeight / 2; + owner.setStyle({ + 'transform': 'translate3d(' + x + 'px,' + y + 'px,0) scale(' + cropper.scale + ') rotate(' + cropper + .angle + 'deg)' + }) +} + +function imageReset(ins) { + cropper.scale = 1; + cropper.angle = 0; + imgTransform(ins); +} + +function updateData(ins) { + if (!ins) return; + ins.callMethod('change', { + cutX: cropper.cutX, + cutY: cropper.cutY, + imgWidth: cropper.imgWidth, + imgHeight: cropper.imgHeight, + scale: cropper.scale, + angle: cropper.angle, + imgTop: cropper.imgTop, + imgLeft: cropper.imgLeft + }) +} + +function valsChange(prop, oldProp, ownerInstance, ins) { + if (prop && prop !== 'null' && ins) { + var params = prop.split('_') + var type = +params[0] + var dataset = ins.getDataset(); + if (cropper.init || type == 4) { + cropper.canvasWidth = +dataset.width; + cropper.canvasHeight = +dataset.height; + cropper.windowHeight = +dataset.windowheight; + cropper.windowWidth = +dataset.windowwidth; + cropper.imgTop = (+dataset.windowheight) / 2; + cropper.imgLeft = (+dataset.windowwidth) / 2; + cropper.imgWidth = +dataset.imgwidth; + cropper.imgHeight = +dataset.imgheight; + cropper.init = false + } else if (type == 2 || type == 3) { + cropper.imgTop = (+dataset.windowheight) / 2; + cropper.imgLeft = (+dataset.windowwidth) / 2; + cropper.imgWidth = +dataset.imgwidth; + cropper.imgHeight = +dataset.imgheight; + } + cropper.angle = +dataset.angle; + if (type == 3) { + imgTransform(ownerInstance); + } + + switch (type) { + case 1: + setCutCenter(ownerInstance); + computeCutSize(ownerInstance); + cutDetectionPosition(ownerInstance); + break; + case 2: + setCutCenter(ownerInstance); + break; + case 3: + imgMarginDetectionScale(ownerInstance) + break; + case 4: + imageReset(ownerInstance); + break; + case 5: + setCutCenter(ownerInstance); + break; + default: + break; + } + } +} + +var movable = false; + +function mousedown(e, ins) { + if (!isH5 || !isPC()) return + touchstart(e, ins) + movable = true + window.onmousemove = function(event) { + if (!isH5 || !isPC() || !movable) return + touchmove(event, ins, e) + } + window.onmouseup = function(event) { + if (!isH5 || !isPC() || !movable) return + touchend(event, ins, e) + movable = false + } +} + +module.exports = { + touchstart: touchstart, + touchmove: touchmove, + touchend: touchend, + valsChange: valsChange, + mousedown: mousedown +} \ No newline at end of file diff --git a/components/firstui/fui-image-cropper/mpjs.js b/components/firstui/fui-image-cropper/mpjs.js new file mode 100644 index 0000000..081234f --- /dev/null +++ b/components/firstui/fui-image-cropper/mpjs.js @@ -0,0 +1,231 @@ +// 本文件由FirstUI授权予新疆天衡创新研究院有限公司(手机号: 18 614072 5 4 9,身份证尾号:5A07X5)专用,请尊重知识产权,勿私下传播,违者追究法律责任。 +// #ifndef APP-PLUS || MP-WEIXIN || H5 +export default { + data() { + return { + touchRelative: [{ + x: 0, + y: 0 + }], + hypotenuseLength: 0, + flagEndTouch: false, + canvasWidth: 0, + canvasHeight: 0 + } + }, + created() { + this.canvasWidth = Number(this.width); + this.canvasHeight = Number(this.height); + }, + watch: { + width(val) { + this.canvasWidth = Number(val); + }, + height(val) { + this.canvasHeight = Number(val); + }, + changeval(val) { + this.valsChange(val) + } + }, + computed: { + getTransform: function() { + return `translate3d(${this.imgLeft - this.imgWidth / 2}px,${this.imgTop - this.imgHeight / 2}px,0) scale(${this.scale}) rotate(${this.angle}deg)`; + } + }, + methods: { + cutDetectionPosition() { + var windowHeight = this.windowHeight, + windowWidth = this.windowWidth; + + var cutDetectionPositionTop = () => { + if (this.cutY < 0) { + this.cutY = 0; + } + if (this.cutY > windowHeight - this.canvasHeight) { + this.cutY = windowHeight - this.canvasHeight; + } + } + + var cutDetectionPositionLeft = () => { + if (this.cutX < 0) { + this.cutX = 0; + } + if (this.cutX > windowWidth - this.canvasWidth) { + this.cutX = windowWidth - this.canvasWidth; + } + } + if (this.cutY == null && this.cutX == null) { + var cutY = (windowHeight - this.canvasHeight) * 0.5; + var cutX = (windowWidth - this.canvasWidth) * 0.5; + this.cutY = cutY; + this.cutX = cutX; + } else if (this.cutY != null && this.cutX != null) { + cutDetectionPositionTop(); + cutDetectionPositionLeft(); + } else if (this.cutY != null && this.cutX == null) { + cutDetectionPositionTop(); + this.cutX = (windowWidth - this.canvasWidth) / 2; + } else if (this.cutY == null && this.cutX != null) { + cutDetectionPositionLeft(); + this.cutY = (windowHeight - this.canvasHeight) / 2; + } + }, + imgMarginDetectionPosition(scale) { + var left = this.imgLeft; + var top = this.imgTop; + scale = scale || this.scale; + var imgWidth = this.imgWidth; + var imgHeight = this.imgHeight; + if ((this.angle / 90) % 2) { + imgWidth = this.imgHeight; + imgHeight = this.imgWidth; + } + left = this.cutX + (imgWidth * scale) / 2 >= left ? left : this.cutX + (imgWidth * scale) / 2; + left = this.cutX + this.canvasWidth - (imgWidth * scale) / 2 <= left ? left : this.cutX + this.canvasWidth - + (imgWidth * scale) / 2; + top = this.cutY + (imgHeight * scale) / 2 >= top ? top : this.cutY + (imgHeight * scale) / 2; + top = this.cutY + this.canvasHeight - (imgHeight * scale) / 2 <= top ? top : this.cutY + this.canvasHeight - + (imgHeight * scale) / 2; + + this.imgLeft = left; + this.imgTop = top; + this.scale = scale; + }, + imgMarginDetectionScale(scale) { + scale = scale || this.scale; + var imgWidth = this.imgWidth; + var imgHeight = this.imgHeight; + if ((this.angle / 90) % 2) { + imgWidth = this.imgHeight; + imgHeight = this.imgWidth; + } + if (imgWidth * scale < this.canvasWidth) { + scale = this.canvasWidth / imgWidth; + } + if (imgHeight * scale < this.canvasHeight) { + scale = Math.max(scale, this.canvasHeight / imgHeight); + } + this.imgMarginDetectionPosition(scale); + }, + computeCutSize() { + if (this.canvasWidth > this.windowWidth) { + this.canvasWidth = this.windowWidth; + } else if (this.canvasWidth + this.cutX > this.windowWidth) { + this.cutX = this.windowWidth - this.cutX; + } + if (this.canvasHeight > this.windowHeight) { + this.canvasHeight = this.windowHeight; + } else if (this.canvasHeight + this.cutY > this.windowHeight) { + this.cutY = this.windowHeight - this.cutY; + } + }, + setCutCenter() { + var cutY = (this.windowHeight - this.canvasHeight) * 0.5; + var cutX = (this.windowWidth - this.canvasWidth) * 0.5; + this.imgTop = this.imgTop - this.cutY + cutY; + this.cutY = cutY; + this.imgLeft = this.imgLeft - this.cutX + cutX; + this.cutX = cutX; + this.cutDetectionPosition() + }, + imageReset() { + this.scale = 1; + this.angle = 0; + }, + touchstart(e) { + var touch = e.touches || e.changedTouches + this.flagEndTouch = false; + if (touch.length == 1) { + this.touchRelative[0] = { + x: touch[0].clientX - this.imgLeft, + y: touch[0].clientY - this.imgTop + }; + } else { + var width = Math.abs(touch[0].clientX - touch[1].clientX); + var height = Math.abs(touch[0].clientY - touch[1].clientY); + this.touchRelative = [{ + x: touch[0].clientX - this.imgLeft, + y: touch[0].clientY - this.imgTop + }, + { + x: touch[1].clientX - this.imgLeft, + y: touch[1].clientY - this.imgTop + } + ]; + this.hypotenuseLength = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)); + } + }, + touchmove(e) { + var touch = e.touches || e.changedTouches + if (this.flagEndTouch) return; + this.moveDuring(); + if (touch.length == 1) { + var left = touch[0].clientX - this.touchRelative[0].x, + top = touch[0].clientY - this.touchRelative[0].y; + this.imgLeft = left; + this.imgTop = top; + this.imgMarginDetectionPosition(); + } else { + var width = Math.abs(touch[0].clientX - touch[1].clientX), + height = Math.abs(touch[0].clientY - touch[1].clientY), + hypotenuse = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)), + scale = this.scale * (hypotenuse / this.hypotenuseLength), + current_deg = 0; + scale = scale <= 0.5 ? 0.5 : scale; + scale = scale >= 2 ? 2 : scale; + this.imgMarginDetectionScale(scale); + var touchRelative = [{ + x: touch[0].clientX - this.imgLeft, + y: touch[0].clientY - this.imgTop + }, + { + x: touch[1].clientX - this.imgLeft, + y: touch[1].clientY - this.imgTop + } + ]; + this.touchRelative = touchRelative; + this.hypotenuseLength = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)); + this.angle = this.angle + current_deg; + this.scale = this.scale; + } + }, + touchend(e) { + this.flagEndTouch = true; + this.moveStop(); + }, + valsChange(val) { + if (val) { + var params = val.split('_') + var type = Number(params[0]) + switch (type) { + case 1: + this.setCutCenter(); + this.computeCutSize(); + this.cutDetectionPosition(); + break; + case 2: + this.setCutCenter(); + break; + case 3: + this.imgMarginDetectionScale() + break; + case 4: + this.imageReset(); + break; + case 5: + this.setCutCenter(); + break; + default: + break; + } + } + } + } +} + +// #endif + +// #ifdef APP-PLUS|| MP-WEIXIN || H5 +export default {} +// #endif \ No newline at end of file diff --git a/components/firstui/fui-index-list/f-index-list-item.vue b/components/firstui/fui-index-list/f-index-list-item.vue new file mode 100644 index 0000000..07b48e7 --- /dev/null +++ b/components/firstui/fui-index-list/f-index-list-item.vue @@ -0,0 +1,256 @@ + + + + + + \ No newline at end of file diff --git a/components/firstui/fui-index-list/fui-index-list.vue b/components/firstui/fui-index-list/fui-index-list.vue new file mode 100644 index 0000000..3ad0f32 --- /dev/null +++ b/components/firstui/fui-index-list/fui-index-list.vue @@ -0,0 +1,649 @@ + +