- 自定义 TabBar 增加弯月面聚光带与银丝边缘,玻璃参数升级 - 全局返回按钮与 ScrollTopMask 返回按钮升级 135° 液态玻璃渐变 - 激活态升级为玻璃透镜,浅色/深色主题同步 - 新增 tools/liquid-glass.test.mjs 回归断言 - 同步构建产物 dist/,并合并此前未提交的 .claude 配置与 dist 变更
1 line
8.4 KiB
JavaScript
1 line
8.4 KiB
JavaScript
"use strict";(wx["webpackJsonp"]=wx["webpackJsonp"]||[]).push([[339],{9519:function(e,s,t){var a=t(7842),n=t(1212),c=t(467),r=t(9379),i=t(5544),l=t(118),o=t(758),d=t.n(o),u=t(6540),h=t(1457),f=t(5787),m=t(9703),x=t(9201),g=t(5414),v=t(9674),j=t(3053),S=t(9513),w=t(4848),N=function(e,s,t){return Math.min(Math.max(e,s),t)};function p(){var e=(0,m.wR)(),s=e.resolvedTheme,t=(0,x.c)();(0,g.l)(s);var a=(0,u.useState)(""),o=(0,i.A)(a,2),p=o[0],T=o[1],k=(0,u.useState)(""),b=(0,i.A)(k,2),A=b[0],y=b[1],E=(0,u.useState)(null),Y=(0,i.A)(E,2),M=Y[0],C=Y[1],I=(0,u.useState)(0),R=(0,i.A)(I,2),D=R[0],B=R[1],P=(0,u.useState)(0),q=(0,i.A)(P,2),Q=q[0],U=q[1],F=(0,u.useState)(0),X=(0,i.A)(F,2),H=X[0],J=X[1],O=(0,u.useState)(!1),_=(0,i.A)(O,2),z=_[0],W=_[1],$=(0,u.useState)(!1),G=(0,i.A)($,2),K=G[0],L=G[1],V=((0,u.useRef)(null),(0,u.useRef)(null)),Z=(0,u.useRef)(null),ee=(0,u.useRef)({width:0,height:0}),se=(0,u.useCallback)(function(e){K||d().nextTick(function(){var s=d().createSelectorQuery();s.select("#editCanvas").fields({node:!0,size:!0}).exec(function(s){var t=s&&s[0],a=t?t.node:void 0;if(a){var n=a.getContext("2d"),c=s[0]&&s[0].width||300,r=s[0]&&s[0].height||400;c<=0&&(c=300),r<=0&&(r=400);var i=d().getSystemInfoSync().pixelRatio||1;a.width=Math.round(c*i),a.height=Math.round(r*i),n.scale(i,i),Z.current=a,V.current=n,ee.current={width:c,height:r},L(!0),te(n,c,r,e)}else setTimeout(function(){return se(e)},300)})})},[K]);(0,u.useEffect)(function(){var e=d().getCurrentInstance().router,s=e?e.params:void 0,t=s?s.designId:"",a=s?s.stickerId:"";T(t),y(a);var n=(0,h.p_)(),c=n.find(function(e){return e.id===t}),r=c&&c.designData&&c.designData.stickers?c.designData.stickers.find(function(e){return e.id===a}):void 0;r&&(C(r),B(r.edits&&r.edits.brightness||0),U(r.edits&&r.edits.hue||0),J(r.edits&&r.edits.contrast||0),se(r))},[se]);var te=function(e,s,t,a,n){if(e&&Z.current){var c=Z.current;if(s&&t){var r=a.width||200,i=a.height||200,l=c.createImage();l.onload=function(){e.clearRect(0,0,s,t),e.save();var a=.9*Math.min(s/r,t/i,4),c=r*a,o=i*a,d=(s-c)/2,u=(t-o)/2,h=n?n.brightness:D,f=n?n.hue:Q,m=n?n.contrast:H;e.filter=0!==h||0!==f||0!==m?"brightness(".concat(100+h,"%) hue-rotate(").concat(f,"deg) contrast(").concat(100+m,"%)"):"none",e.drawImage(l,d,u,c,o),e.restore()},l.onerror=function(e){console.error("Canvas load image error:",e,a.src),d().showToast({title:"\u56fe\u7247\u52a0\u8f7d\u5931\u8d25",icon:"none"})},a.src&&(l.src=a.src)}}},ae=function(){if(M&&V.current&&Z.current){var e=ee.current,s=e.width,t=e.height;te(V.current,s,t,M,{brightness:D,hue:Q,contrast:H})}};(0,u.useEffect)(function(){ae()},[D,Q,H]);var ne=function(){M&&p&&(W(!0),d().canvasToTempFilePath({canvas:Z.current,quality:.92,success:function(e){var s=e.tempFilePath,t=(0,h.p_)(),a=t.findIndex(function(e){return e.id===p});if(-1!==a){var n=t[a].designData&&t[a].designData.stickers||[],c=n.findIndex(function(e){return e.id===A});-1!==c?(n[c]=(0,r.A)((0,r.A)({},n[c]),{},{src:s,edits:{brightness:D,hue:Q,contrast:H}}),(0,h.i5)(p,{designData:(0,r.A)((0,r.A)({},t[a].designData),{},{stickers:n})}),d().showToast({title:"\u4fdd\u5b58\u6210\u529f",icon:"success"}),d().navigateBack()):W(!1)}else W(!1)},fail:function(){W(!1),d().showToast({title:"\u4fdd\u5b58\u5931\u8d25",icon:"none"})}}))},ce=function(){M&&(d().cropImage?d().cropImage({src:M.src,cropScale:"1:1",success:function(e){var s=(0,r.A)((0,r.A)({},M),{},{src:e.tempFilePath});C(s),setTimeout(function(){return ae()},200)}}):d().showToast({title:"\u5f53\u524d\u5fae\u4fe1\u7248\u672c\u4e0d\u652f\u6301\u88c1\u526a",icon:"none"}))},re=function(){var e=(0,c.A)((0,n.A)().m(function e(){var s,t;return(0,n.A)().w(function(e){while(1)switch(e.p=e.n){case 0:if(M){e.n=1;break}return e.a(2);case 1:return W(!0),e.p=2,e.n=3,(0,f.W$)(M.src);case 3:if(s=e.v,null===s||void 0===s||!s.imageUrl){e.n=4;break}t=(0,r.A)((0,r.A)({},M),{},{src:s.imageUrl,edits:(0,r.A)((0,r.A)({},M.edits),{},{sketchSrc:s.imageUrl})}),C(t),W(!1),setTimeout(function(){return ae()},200),d().showToast({title:"\u7ebf\u7a3f\u751f\u6210\u6210\u529f",icon:"success"}),e.n=5;break;case 4:throw new Error("no imageUrl");case 5:e.n=7;break;case 6:e.p=6,e.v,ie();case 7:return e.a(2)}},e,null,[[2,6]])}));return function(){return e.apply(this,arguments)}}(),ie=function(){M&&V.current?(d().showToast({title:"\u4f7f\u7528\u672c\u5730\u7ebf\u7a3f",icon:"none"}),B(20),J(80),U(0),W(!1)):W(!1)},le="".concat((D+100)/200*100,"%"),oe="".concat((Q+180)/360*100,"%"),de="".concat((H+100)/200*100,"%");return(0,w.jsxs)(l.Ss,{className:"theme-".concat(s),children:[(0,w.jsx)(v.A,{}),(0,w.jsx)(j.A,{title:"\u7f16\u8f91\u8d34\u7eb8",targetSelector:".edit-header",showBack:!0}),(0,w.jsxs)(l.Ss,{className:"sticker-edit-page",children:[(0,w.jsxs)(l.Ss,{className:"edit-header",style:{paddingTop:"".concat(t.statusBarHeight+12,"px")},children:[(0,w.jsx)(l.EY,{className:"edit-back",onTap:function(){return d().navigateBack()},children:"\u2190"}),(0,w.jsx)(l.EY,{className:"edit-title",children:"\u7f16\u8f91\u8d34\u7eb8"}),(0,w.jsx)(l.EY,{className:"edit-save",onTap:ne,children:"\u4fdd\u5b58"})]}),(0,w.jsx)(l.Ss,{className:"edit-canvas-wrap",children:(0,w.jsx)(l.Hl,{id:"editCanvas",type:"2d",className:"edit-canvas",style:{width:"100%",height:"480rpx"}})}),(0,w.jsxs)(l.Ss,{className:"edit-tools surface-card mt-20",children:[(0,w.jsxs)(l.Ss,{className:"edit-row",children:[(0,w.jsx)(l.EY,{className:"edit-label",children:"\u5feb\u901f\u64cd\u4f5c"}),(0,w.jsxs)(l.Ss,{className:"edit-quick-actions",children:[(0,w.jsx)(l.Ss,{className:"quick-btn",onTap:ce,children:(0,w.jsx)(l.EY,{children:"\u88c1\u526a"})}),(0,w.jsx)(l.Ss,{className:"quick-btn",onTap:re,children:(0,w.jsx)(l.EY,{children:"\u8f6c\u7ebf\u7a3f"})})]})]}),(0,w.jsxs)(l.Ss,{className:"edit-row slider-row",onTouchMove:function(e){var s=e.changedTouches[0].clientX,t=d().createSelectorQuery().in(e.currentTarget);t.select(".slider-track").boundingClientRect(function(e){if(e){var t=N((s-e.left)/e.width,0,1),a=1*Math.round((200*t-100)/1);B(N(a,-100,100))}}).exec()},children:[(0,w.jsx)(l.EY,{className:"edit-label",children:"\u4eae\u5ea6"}),(0,w.jsxs)(l.Ss,{className:"slider-wrap",children:[(0,w.jsxs)(l.Ss,{className:"slider-track",children:[(0,w.jsx)(l.Ss,{className:"slider-fill",style:{width:le}}),(0,w.jsx)(l.Ss,{className:"slider-thumb",style:{left:le}})]}),(0,w.jsx)(l.EY,{className:"slider-value",children:D>0?"+".concat(D):D})]})]}),(0,w.jsxs)(l.Ss,{className:"edit-row slider-row",onTouchMove:function(e){var s=e.changedTouches[0].clientX,t=d().createSelectorQuery().in(e.currentTarget);t.select(".slider-track").boundingClientRect(function(e){if(e){var t=N((s-e.left)/e.width,0,1),a=1*Math.round((360*t-180)/1);U(N(a,-180,180))}}).exec()},children:[(0,w.jsx)(l.EY,{className:"edit-label",children:"\u8272\u76f8"}),(0,w.jsxs)(l.Ss,{className:"slider-wrap",children:[(0,w.jsxs)(l.Ss,{className:"slider-track",children:[(0,w.jsx)(l.Ss,{className:"slider-fill",style:{width:oe}}),(0,w.jsx)(l.Ss,{className:"slider-thumb",style:{left:oe}})]}),(0,w.jsx)(l.EY,{className:"slider-value",children:Q>0?"+".concat(Q):Q})]})]}),(0,w.jsxs)(l.Ss,{className:"edit-row slider-row",onTouchMove:function(e){var s=e.changedTouches[0].clientX,t=d().createSelectorQuery().in(e.currentTarget);t.select(".slider-track").boundingClientRect(function(e){if(e){var t=N((s-e.left)/e.width,0,1),a=1*Math.round((200*t-100)/1);J(N(a,-100,100))}}).exec()},children:[(0,w.jsx)(l.EY,{className:"edit-label",children:"\u5bf9\u6bd4\u5ea6"}),(0,w.jsxs)(l.Ss,{className:"slider-wrap",children:[(0,w.jsxs)(l.Ss,{className:"slider-track",children:[(0,w.jsx)(l.Ss,{className:"slider-fill",style:{width:de}}),(0,w.jsx)(l.Ss,{className:"slider-thumb",style:{left:de}})]}),(0,w.jsx)(l.EY,{className:"slider-value",children:H>0?"+".concat(H):H})]})]})]}),(0,w.jsx)(l.Ss,{style:{flex:1}}),(0,w.jsxs)(S.A,{className:"edit-footer",children:[(0,w.jsx)(l.Ss,{className:"btn-secondary",onTap:function(){return d().navigateBack()},children:(0,w.jsx)(l.EY,{children:"\u53d6\u6d88"})}),(0,w.jsx)(l.Ss,{className:"btn-primary",onTap:ne,children:(0,w.jsx)(l.EY,{children:"\u4fdd\u5b58"})})]}),(0,w.jsx)(l.Ss,{className:"safe-bottom-placeholder"}),z&&(0,w.jsx)(l.Ss,{className:"edit-loading",children:(0,w.jsx)(l.EY,{className:"edit-loading-text",children:"\u5904\u7406\u4e2d\u2026"})})]})]})}var T={navigationStyle:"custom",enablePageMeta:!0,navigationBarTitleText:"\u7f16\u8f91\u8d34\u7eb8"};Page((0,a.createPageConfig)(p,"pages/diy/stickerEdit/index",{root:{cn:[]}},T||{}))}},function(e){var s=function(s){return e(e.s=s)};e.O(0,[907,96,76],function(){return s(9519)});e.O()}]); |