@netless/window-manager 0.3.22 → 0.3.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/settings.json +1 -0
- package/dist/AppListener.d.ts +1 -0
- package/dist/AppManager.d.ts +2 -0
- package/dist/AppProxy.d.ts +3 -2
- package/dist/AttributesDelegate.d.ts +0 -4
- package/dist/BoxManager.d.ts +1 -1
- package/dist/Cursor/Cursor.d.ts +8 -12
- package/dist/Cursor/index.d.ts +5 -14
- package/dist/MainView.d.ts +3 -2
- package/dist/ViewManager.d.ts +3 -2
- package/dist/constants.d.ts +2 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.es.js +41 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +41 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -5
- package/src/AppContext.ts +1 -1
- package/src/AppListener.ts +9 -1
- package/src/AppManager.ts +11 -4
- package/src/AppProxy.ts +9 -7
- package/src/AttributesDelegate.ts +0 -28
- package/src/BoxManager.ts +21 -24
- package/src/Cursor/Cursor.ts +34 -59
- package/src/Cursor/index.ts +53 -130
- package/src/MainView.ts +11 -12
- package/src/constants.ts +1 -0
- package/src/index.ts +93 -55
- package/src/style.css +1 -1
- package/src/viewManager.ts +4 -5
- package/vite.config.js +4 -2
- package/dist/Base/Context.d.ts +0 -13
- package/dist/Base/index.d.ts +0 -8
- package/src/Base/Context.ts +0 -49
- package/src/Base/index.ts +0 -10
package/dist/style.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.netless-window-manager-playground{width:100%;height:100%;position:relative;z-index:1;overflow:hidden;user-select:none}.netless-window-manager-sizer{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;overflow:hidden;display:flex}.netless-window-manager-sizer-horizontal{flex-direction:column}.netless-window-manager-sizer:before,.netless-window-manager-sizer:after{flex:1;content:"";display:block}.netless-window-manager-chess-sizer:before,.netless-window-manager-chess-sizer:after{background-image:linear-gradient(45deg,#b0b0b0 25%,transparent 25%),linear-gradient(-45deg,#b0b0b0 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#b0b0b0 75%),linear-gradient(-45deg,transparent 75%,#b0b0b0 75%);background-color:#fff;background-size:20px 20px;background-position:0 0,0 10px,10px -10px,-10px 0px}.netless-window-manager-wrapper{position:relative;z-index:1;width:100%;height:100%;overflow:hidden}.netless-window-manager-main-view{width:100%;height:100%}.netless-window-manager-cursor-pencil-image{width:26px;height:26px}.netless-window-manager-cursor-eraser-image{width:26px;height:26px}.netless-window-manager-cursor-selector-image{width:24px;height:24px}.netless-window-manager-cursor-selector-avatar{border-radius:50%;border-style:solid;border-width:2px;border-color:#fff;margin-bottom:2px}.netless-window-manager-cursor-selector-avatar img{width:12px}.netless-window-manager-cursor-inner{border-radius:4px;display:flex;align-items:center;justify-content:center;flex-direction:row;padding-left:4px;padding-right:4px;font-size:12px}.netless-window-manager-cursor-inner-mellow{height:32px;border-radius:16px;display:flex;align-items:center;justify-content:center;flex-direction:row;padding-left:16px;padding-right:16px}.netless-window-manager-cursor-tag-name{font-size:12px;margin-left:4px;padding:2px 8px;border-radius:4px}.netless-window-manager-cursor-mid{display:flex;flex-direction:column;align-items:center;justify-content:center;position:fixed;width:26px;height:26px;z-index:2147483647;left:0;top:0;will-change:transform;transition:transform .05s;transform-origin:0 0;user-select:none;pointer-events:none}.netless-window-manager-cursor-pencil-offset{margin-left:-20px}.netless-window-manager-cursor-selector-offset{margin-left:-22px;margin-top:56px}.netless-window-manager-cursor-text-offset{margin-left:-30px;margin-top:18px}.netless-window-manager-cursor-shape-offset{display:flex;flex-direction:column;align-items:center;justify-content:center;position:absolute;width:180px;height:64px;margin-left:-30px;margin-top:12px}.netless-window-manager-cursor-name{width:100%;height:48px;display:flex;align-items:center;justify-content:center;position:absolute;top:-40px}.cursor-image-wrapper{display:flex;justify-content:center}.telebox-collector{position:absolute;right:10px;bottom:15px}.tele-fancy-scrollbar{overscroll-behavior:contain;overflow:auto;overflow-y:scroll;overflow-y:overlay;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;scrollbar-width:auto}.tele-fancy-scrollbar::-webkit-scrollbar{height:8px;width:8px}.tele-fancy-scrollbar::-webkit-scrollbar-track{background-color:transparent}.tele-fancy-scrollbar::-webkit-scrollbar-thumb{background-color:#444e601a;background-color:transparent;border-radius:4px;transition:background-color .4s}.tele-fancy-scrollbar:hover::-webkit-scrollbar-thumb{background-color:#444e601a}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:hover{background-color:#444e6033}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:active{background-color:#444e6033}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:vertical{min-height:50px}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:horizontal{min-width:50px}.telebox-box{position:absolute;top:0;left:0;z-index:100;transition:width .4s cubic-bezier(.4,.9,.71,1.02),height .4s cubic-bezier(.55,.82,.63,.95),opacity .6s cubic-bezier(.7,0,.84,0),transform .4s ease}.telebox-box-main{position:relative;width:100%;height:100%;display:flex;flex-direction:column;overflow:hidden;background:#f9f9fc;box-shadow:0 4px 10px #2f419226;border-radius:6px;border:1px solid #e3e3ec}.telebox-titlebar-wrap{flex-shrink:0;position:relative;z-index:1}.telebox-content-wrap{flex:1;width:100%;overflow:hidden;display:flex;justify-content:center;align-items:center}.telebox-content{width:100%;height:100%;position:relative}.telebox-footer-wrap{flex-shrink:0;display:flex;flex-direction:column}.telebox-footer-wrap:before{content:"";display:block;flex:1}.telebox-resize-handle{position:absolute;z-index:2147483647}.telebox-n{width:100%;height:5px;left:0;top:-5px;cursor:n-resize}.telebox-s{width:100%;height:5px;left:0;bottom:-5px;cursor:s-resize}.telebox-w{width:5px;height:100%;left:-5px;top:0;cursor:w-resize}.telebox-e{width:5px;height:100%;right:-5px;top:0;cursor:e-resize}.telebox-nw{width:15px;height:15px;top:-5px;left:-5px;cursor:nw-resize}.telebox-ne{width:15px;height:15px;top:-5px;right:-5px;cursor:ne-resize}.telebox-se{width:15px;height:15px;bottom:-5px;right:-5px;cursor:se-resize}.telebox-sw{width:15px;height:15px;bottom:-5px;left:-5px;cursor:sw-resize}.telebox-track-mask{position:fixed;top:0;left:0;z-index:2147483647;width:100%;height:100%;background:rgba(0,0,0,.0001);cursor:move}.telebox-cursor-n{cursor:n-resize}.telebox-cursor-s{cursor:s-resize}.telebox-cursor-w{cursor:w-resize}.telebox-cursor-e{cursor:e-resize}.telebox-cursor-nw{cursor:nw-resize}.telebox-cursor-ne{cursor:ne-resize}.telebox-cursor-se{cursor:se-resize}.telebox-cursor-sw{cursor:sw-resize}.telebox-maximized .telebox-resize-handles,.telebox-no-resize .telebox-resize-handles{display:none}.telebox-maximized{box-shadow:none;transition:none}.telebox-minimized{transition:width 50ms cubic-bezier(.4,.9,.71,1.02),height 50ms cubic-bezier(.55,.82,.63,.95),opacity .6s cubic-bezier(.7,0,.84,0),transform .6s ease;opacity:0;pointer-events:none;user-select:none}.telebox-transforming{will-change:transform;transition:opacity .6s cubic-bezier(.7,0,.84,0)}.telebox-readonly .telebox-resize-handle{cursor:initial!important;pointer-events:none!important}.telebox-color-scheme-dark .telebox-box-main{color:#e9e9e9;background:#212126;border-color:#43434d}.telebox-titlebar{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;background:#fff;user-select:none;border-bottom:1px solid #eeeef7;touch-action:manipulation}.telebox-title-area{overflow:hidden;position:relative;height:100%;flex:1;display:flex;align-items:center}.telebox-title{overflow:hidden;margin:0;padding:0;font-size:14px;font-weight:400;font-family:PingFangSC-Regular,PingFang SC;white-space:nowrap;word-break:keep-all;text-overflow:ellipsis;color:#191919}.telebox-drag-area{position:absolute;top:0;left:0;right:0;bottom:0;margin:auto;z-index:10}.telebox-titlebar-btns{white-space:nowrap;word-break:keep-all;margin-left:auto;font-size:0}.telebox-titlebar-btn{width:22px;height:22px;padding:0;outline:0;border:none;background:0 0;cursor:pointer}.telebox-titlebar-btn~.telebox-titlebar-btn{margin-left:10px}.telebox-titlebar-btn-icon{width:22px;height:22px}.telebox-readonly .telebox-titlebar-btn{cursor:not-allowed}.telebox-titlebar-icon-minimize{background:center/cover no-repeat url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjh2MjhIMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxtYXNrIGlkPSJiIiBmaWxsPSIjZmZmIj4KICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjYSIgLz4KICAgICAgICA8L21hc2s+CiAgICAgICAgPHBhdGggZmlsbD0iI0E3QTdDQSIgZmlsbC1ydWxlPSJub256ZXJvIiBkPSJNOSAxM2gxMHYxLjZIOXoiIG1hc2s9InVybCgjYikiIC8+CiAgICA8L2c+Cjwvc3ZnPgo=)}.telebox-titlebar-icon-maximize{background:center/cover no-repeat url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjh2MjhIMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxtYXNrIGlkPSJiIiBmaWxsPSIjZmZmIj4KICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjYSIgLz4KICAgIC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-color-scheme-dark .telebox-titlebar{color:#e9e9e9;background:#43434d;border-bottom:none}.telebox-collector{visibility:hidden;display:block;position:absolute;z-index:200;width:40px;height:40px;margin:0;padding:0;border:none;outline:0;font-size:0;border-radius:50%;background:#fff;box-shadow:0 2px 6px #2f419226;cursor:pointer;user-select:none;pointer-events:none;background-repeat:no-repeat;background-size:18px 16px;background-position:center}.telebox-collector-visible{visibility:visible;pointer-events:initial}.telebox-collector-readonly{cursor:not-allowed}.telebox-color-scheme-dark.telebox-collector{background-color:#43434d}.telebox-max-titlebar{display:none;position:absolute;top:0;left:0;z-index:50000;user-select:none}.telebox-max-titlebar .telebox-drag-area{height:100%;min-width:16px;position:static;margin:0;flex-grow:1;flex-shrink:0}.telebox-max-titlebar-maximized{display:flex}.telebox-titles{height:100%;margin:0;overflow-y:hidden;overflow-x:scroll;overflow-x:overlay;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;scrollbar-width:auto}.telebox-titles::-webkit-scrollbar{height:8px;width:8px}.telebox-titles::-webkit-scrollbar-track{background-color:transparent}.telebox-titles::-webkit-scrollbar-thumb{background-color:#eeeef7cc;background-color:transparent;border-radius:4px;transition:background-color .4s}.telebox-titles:hover::-webkit-scrollbar-thumb{background-color:#eeeef7cc}.telebox-titles::-webkit-scrollbar-thumb:hover{background-color:#eeeef7}.telebox-titles::-webkit-scrollbar-thumb:active{background-color:#eeeef7}.telebox-titles::-webkit-scrollbar-thumb:vertical{min-height:50px}.telebox-titles::-webkit-scrollbar-thumb:horizontal{min-width:50px}.telebox-titles-content{height:100%;display:flex;flex-wrap:nowrap;align-items:center;padding:0}.telebox-titles-tab{height:100%;overflow:hidden;max-width:182px;min-width:50px;padding:0 26px 0 16px;outline:0;font-size:13px;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;text-overflow:ellipsis;white-space:nowrap;word-break:keep-all;border:none;border-right:1px solid #e5e5f0;color:#7b88a0;background:0 0;cursor:pointer;user-select:none}.telebox-titles-tab-focus{color:#357bf6}.telebox-readonly .telebox-titles-tab{cursor:not-allowed}.telebox-color-scheme-dark{color-scheme:dark}.telebox-color-scheme-dark.telebox-titlebar{color:#e9e9e9;background:#43434d;border-bottom:none}.telebox-color-scheme-dark .telebox-titles-tab{border-right-color:#7b88a0}.telebox-color-scheme-dark .telebox-title{color:#e9e9e9}
|
1
|
+
.netless-window-manager-playground{width:100%;height:100%;position:relative;z-index:1;overflow:hidden;user-select:none}.netless-window-manager-sizer{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;overflow:hidden;display:flex}.netless-window-manager-sizer-horizontal{flex-direction:column}.netless-window-manager-sizer:before,.netless-window-manager-sizer:after{flex:1;content:"";display:block}.netless-window-manager-chess-sizer:before,.netless-window-manager-chess-sizer:after{background-image:linear-gradient(45deg,#b0b0b0 25%,transparent 25%),linear-gradient(-45deg,#b0b0b0 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#b0b0b0 75%),linear-gradient(-45deg,transparent 75%,#b0b0b0 75%);background-color:#fff;background-size:20px 20px;background-position:0 0,0 10px,10px -10px,-10px 0px}.netless-window-manager-wrapper{position:relative;z-index:1;width:100%;height:100%;overflow:hidden}.netless-window-manager-main-view{width:100%;height:100%}.netless-window-manager-cursor-pencil-image{width:26px;height:26px}.netless-window-manager-cursor-eraser-image{width:26px;height:26px}.netless-window-manager-cursor-selector-image{width:24px;height:24px}.netless-window-manager-cursor-selector-avatar{border-radius:50%;border-style:solid;border-width:2px;border-color:#fff;margin-bottom:2px}.netless-window-manager-cursor-selector-avatar img{width:12px}.netless-window-manager-cursor-inner{border-radius:4px;display:flex;align-items:center;justify-content:center;flex-direction:row;padding-left:4px;padding-right:4px;font-size:12px}.netless-window-manager-cursor-inner-mellow{height:32px;border-radius:16px;display:flex;align-items:center;justify-content:center;flex-direction:row;padding-left:16px;padding-right:16px}.netless-window-manager-cursor-tag-name{font-size:12px;margin-left:4px;padding:2px 8px;border-radius:4px}.netless-window-manager-cursor-mid{display:flex;flex-direction:column;align-items:center;justify-content:center;position:fixed;width:26px;height:26px;z-index:2147483647;left:0;top:0;will-change:transform;transition:transform .1s;transform-origin:0 0;user-select:none;pointer-events:none}.netless-window-manager-cursor-pencil-offset{margin-left:-20px}.netless-window-manager-cursor-selector-offset{margin-left:-22px;margin-top:56px}.netless-window-manager-cursor-text-offset{margin-left:-30px;margin-top:18px}.netless-window-manager-cursor-shape-offset{display:flex;flex-direction:column;align-items:center;justify-content:center;position:absolute;width:180px;height:64px;margin-left:-30px;margin-top:12px}.netless-window-manager-cursor-name{width:100%;height:48px;display:flex;align-items:center;justify-content:center;position:absolute;top:-40px}.cursor-image-wrapper{display:flex;justify-content:center}.telebox-collector{position:absolute;right:10px;bottom:15px}.tele-fancy-scrollbar{overscroll-behavior:contain;overflow:auto;overflow-y:scroll;overflow-y:overlay;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;scrollbar-width:auto}.tele-fancy-scrollbar::-webkit-scrollbar{height:8px;width:8px}.tele-fancy-scrollbar::-webkit-scrollbar-track{background-color:transparent}.tele-fancy-scrollbar::-webkit-scrollbar-thumb{background-color:#444e601a;background-color:transparent;border-radius:4px;transition:background-color .4s}.tele-fancy-scrollbar:hover::-webkit-scrollbar-thumb{background-color:#444e601a}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:hover{background-color:#444e6033}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:active{background-color:#444e6033}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:vertical{min-height:50px}.tele-fancy-scrollbar::-webkit-scrollbar-thumb:horizontal{min-width:50px}.telebox-box{position:absolute;top:0;left:0;z-index:100;transition:width .4s cubic-bezier(.4,.9,.71,1.02),height .4s cubic-bezier(.55,.82,.63,.95),opacity .6s cubic-bezier(.7,0,.84,0),transform .4s ease}.telebox-box-main{position:relative;width:100%;height:100%;display:flex;flex-direction:column;overflow:hidden;background:#f9f9fc;box-shadow:0 4px 10px #2f419226;border-radius:6px;border:1px solid #e3e3ec}.telebox-titlebar-wrap{flex-shrink:0;position:relative;z-index:1}.telebox-content-wrap{flex:1;width:100%;overflow:hidden;display:flex;justify-content:center;align-items:center}.telebox-content{width:100%;height:100%;position:relative}.telebox-footer-wrap{flex-shrink:0;display:flex;flex-direction:column}.telebox-footer-wrap:before{content:"";display:block;flex:1}.telebox-resize-handle{position:absolute;z-index:2147483647}.telebox-n{width:100%;height:5px;left:0;top:-5px;cursor:n-resize}.telebox-s{width:100%;height:5px;left:0;bottom:-5px;cursor:s-resize}.telebox-w{width:5px;height:100%;left:-5px;top:0;cursor:w-resize}.telebox-e{width:5px;height:100%;right:-5px;top:0;cursor:e-resize}.telebox-nw{width:15px;height:15px;top:-5px;left:-5px;cursor:nw-resize}.telebox-ne{width:15px;height:15px;top:-5px;right:-5px;cursor:ne-resize}.telebox-se{width:15px;height:15px;bottom:-5px;right:-5px;cursor:se-resize}.telebox-sw{width:15px;height:15px;bottom:-5px;left:-5px;cursor:sw-resize}.telebox-track-mask{position:fixed;top:0;left:0;z-index:2147483647;width:100%;height:100%;background:rgba(0,0,0,.0001);cursor:move}.telebox-cursor-n{cursor:n-resize}.telebox-cursor-s{cursor:s-resize}.telebox-cursor-w{cursor:w-resize}.telebox-cursor-e{cursor:e-resize}.telebox-cursor-nw{cursor:nw-resize}.telebox-cursor-ne{cursor:ne-resize}.telebox-cursor-se{cursor:se-resize}.telebox-cursor-sw{cursor:sw-resize}.telebox-maximized .telebox-resize-handles,.telebox-no-resize .telebox-resize-handles{display:none}.telebox-maximized{box-shadow:none;transition:none}.telebox-minimized{transition:width 50ms cubic-bezier(.4,.9,.71,1.02),height 50ms cubic-bezier(.55,.82,.63,.95),opacity .6s cubic-bezier(.7,0,.84,0),transform .6s ease;opacity:0;pointer-events:none;user-select:none}.telebox-transforming{will-change:transform;transition:opacity .6s cubic-bezier(.7,0,.84,0)}.telebox-readonly .telebox-resize-handle{cursor:initial!important;pointer-events:none!important}.telebox-color-scheme-dark .telebox-box-main{color:#e9e9e9;background:#212126;border-color:#43434d}.telebox-titlebar{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;background:#fff;user-select:none;border-bottom:1px solid #eeeef7;touch-action:manipulation}.telebox-title-area{overflow:hidden;position:relative;height:100%;flex:1;display:flex;align-items:center}.telebox-title{overflow:hidden;margin:0;padding:0;font-size:14px;font-weight:400;font-family:PingFangSC-Regular,PingFang SC;white-space:nowrap;word-break:keep-all;text-overflow:ellipsis;color:#191919}.telebox-drag-area{position:absolute;top:0;left:0;right:0;bottom:0;margin:auto;z-index:10}.telebox-titlebar-btns{white-space:nowrap;word-break:keep-all;margin-left:auto;font-size:0}.telebox-titlebar-btn{width:22px;height:22px;padding:0;outline:0;border:none;background:0 0;cursor:pointer}.telebox-titlebar-btn~.telebox-titlebar-btn{margin-left:10px}.telebox-titlebar-btn-icon{width:22px;height:22px}.telebox-readonly .telebox-titlebar-btn{cursor:not-allowed}.telebox-titlebar-icon-minimize{background:center/cover no-repeat url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjh2MjhIMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxtYXNrIGlkPSJiIiBmaWxsPSIjZmZmIj4KICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjYSIgLz4KICAgICAgICA8L21hc2s+CiAgICAgICAgPHBhdGggZmlsbD0iI0E3QTdDQSIgZmlsbC1ydWxlPSJub256ZXJvIiBkPSJNOSAxM2gxMHYxLjZIOXoiIG1hc2s9InVybCgjYikiIC8+CiAgICA8L2c+Cjwvc3ZnPgo=)}.telebox-titlebar-icon-maximize{background:center/cover no-repeat url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBhdGggaWQ9ImEiIGQ9Ik0wIDBoMjh2MjhIMHoiIC8+CiAgICA8L2RlZnM+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxtYXNrIGlkPSJiIiBmaWxsPSIjZmZmIj4KICAgICAgICAgICAgPHVzZSB4bGluazpocmVmPSIjYSIgLz4KICAgICAgICA8L21hc2s+CiAgICAgICAgPGcgZmlsbD0iI0E3QTdDQSIgZmlsbC1ydWxlPSJub256ZXJvIiBtYXNrPSJ1cmwoI2IpIj4KICAgICAgICAgICAgPHBhdGgKICAgICAgICAgICAgICAgIGQ9Ik0yMC40ODEgMTcuMWgxLjJ2NC41ODFIMTcuMXYtMS4yaDMuMzgxVjE3LjF6bS0xNC4xOTA1LS4wMDloMS4ydjMuMzgxaDMuMzgwOXYxLjJoLTQuNTgxdi00LjU4MXpNMTcuMSA2LjE5MDVoNC41ODF2NC41ODA5aC0xLjJ2LTMuMzgxSDE3LjF2LTEuMnptLTEwLjcwMDguMTA4N2g0Ljc5ODV2MS4ySDcuNTk5MnYzLjU5ODVoLTEuMlY2LjI5OTJ6IiAvPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+Cg==)}.telebox-titlebar-icon-maximize.is-active{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2aWV3Qm94PSIwIDAgMjggMjgiPgogICAgPGRlZnM+CiAgICAgICAgPHBh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5ODVINi4zNTE3IiAvPgogICAgPC9nPgo8L3N2Zz4K)}.telebox-titlebar-icon-close{background:center/cover no-repeat url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyOCAyOCI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZT0iI0E3QTdDQSIgc3Ryb2tlLXdpZHRoPSIxLjQiPgogICAgICAgIDxwYXRoIGQ9Ik04LjM1MyAyMC4zMzIxTDIwLjMzMiA4LjM1M00yMC4zMzIyIDIwLjMzMjFMOC4zNTMgOC4zNTMiIC8+CiAgICA8L2c+Cjwvc3ZnPgo=)}.telebox-color-scheme-dark .telebox-titlebar{color:#e9e9e9;background:#43434d;border-bottom:none}.telebox-collector{visibility:hidden;display:block;position:absolute;z-index:200;width:40px;height:40px;margin:0;padding:0;border:none;outline:0;font-size:0;border-radius:50%;background:#fff;box-shadow:0 2px 6px #2f419226;cursor:pointer;user-select:none;pointer-events:none;background-repeat:no-repeat;background-size:18px 16px;background-position:center}.telebox-collector-visible{visibility:visible;pointer-events:initial}.telebox-collector-readonly{cursor:not-allowed}.telebox-color-scheme-dark.telebox-collector{background-color:#43434d}.telebox-max-titlebar{display:none;position:absolute;top:0;left:0;z-index:50000;user-select:none}.telebox-max-titlebar .telebox-drag-area{height:100%;min-width:16px;position:static;margin:0;flex-grow:1;flex-shrink:0}.telebox-max-titlebar-maximized{display:flex}.telebox-titles{height:100%;margin:0;overflow-y:hidden;overflow-x:scroll;overflow-x:overlay;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;scrollbar-width:auto}.telebox-titles::-webkit-scrollbar{height:8px;width:8px}.telebox-titles::-webkit-scrollbar-track{background-color:transparent}.telebox-titles::-webkit-scrollbar-thumb{background-color:#eeeef7cc;background-color:transparent;border-radius:4px;transition:background-color .4s}.telebox-titles:hover::-webkit-scrollbar-thumb{background-color:#eeeef7cc}.telebox-titles::-webkit-scrollbar-thumb:hover{background-color:#eeeef7}.telebox-titles::-webkit-scrollbar-thumb:active{background-color:#eeeef7}.telebox-titles::-webkit-scrollbar-thumb:vertical{min-height:50px}.telebox-titles::-webkit-scrollbar-thumb:horizontal{min-width:50px}.telebox-titles-content{height:100%;display:flex;flex-wrap:nowrap;align-items:center;padding:0}.telebox-titles-tab{height:100%;overflow:hidden;max-width:182px;min-width:50px;padding:0 26px 0 16px;outline:0;font-size:13px;font-family:PingFangSC-Regular,PingFang SC;font-weight:400;text-overflow:ellipsis;white-space:nowrap;word-break:keep-all;border:none;border-right:1px solid #e5e5f0;color:#7b88a0;background:0 0;cursor:pointer;user-select:none}.telebox-titles-tab-focus{color:#357bf6}.telebox-readonly .telebox-titles-tab{cursor:not-allowed}.telebox-color-scheme-dark{color-scheme:dark}.telebox-color-scheme-dark.telebox-titlebar{color:#e9e9e9;background:#43434d;border-bottom:none}.telebox-color-scheme-dark .telebox-titles-tab{border-right-color:#7b88a0}.telebox-color-scheme-dark .telebox-title{color:#e9e9e9}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@netless/window-manager",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.25",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/index.es.js",
|
6
6
|
"module": "dist/index.es.js",
|
@@ -22,9 +22,6 @@
|
|
22
22
|
},
|
23
23
|
"dependencies": {
|
24
24
|
"@juggle/resize-observer": "^3.3.1",
|
25
|
-
"@netless/app-docs-viewer": "0.2.5",
|
26
|
-
"@netless/app-media-player": "0.1.0-beta.5",
|
27
|
-
"@netless/telebox-insider": "0.2.21",
|
28
25
|
"emittery": "^0.9.2",
|
29
26
|
"lodash": "^4.17.21",
|
30
27
|
"p-retry": "^4.6.1",
|
@@ -32,6 +29,9 @@
|
|
32
29
|
"video.js": ">=7"
|
33
30
|
},
|
34
31
|
"devDependencies": {
|
32
|
+
"@netless/app-docs-viewer": "0.2.5",
|
33
|
+
"@netless/app-media-player": "0.1.0-beta.5",
|
34
|
+
"@netless/telebox-insider": "0.2.21",
|
35
35
|
"@rollup/plugin-commonjs": "^20.0.0",
|
36
36
|
"@rollup/plugin-node-resolve": "^13.0.4",
|
37
37
|
"@rollup/plugin-url": "^6.1.0",
|
@@ -56,6 +56,6 @@
|
|
56
56
|
"typescript": "^4.3.5",
|
57
57
|
"video.js": "^7.14.3",
|
58
58
|
"vite": "^2.5.3",
|
59
|
-
"white-web-sdk": "2.15.
|
59
|
+
"white-web-sdk": "^2.15.16"
|
60
60
|
}
|
61
61
|
}
|
package/src/AppContext.ts
CHANGED
@@ -103,7 +103,7 @@ export class AppContext<TAttrs extends Record<string, any>, AppOptions = any> {
|
|
103
103
|
public async setScenePath(scenePath: string): Promise<void> {
|
104
104
|
if (!this.appProxy.box) return;
|
105
105
|
this.appProxy.setFullPath(scenePath);
|
106
|
-
this.
|
106
|
+
this.manager.viewManager.switchAppToWriter(this.appId);
|
107
107
|
}
|
108
108
|
|
109
109
|
public mountView(dom: HTMLDivElement): void {
|
package/src/AppListener.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { callbacks } from './index';
|
1
|
+
import { callbacks, emitter } from './index';
|
2
2
|
import { Events, MagixEventName } from './constants';
|
3
3
|
import type { Event } from "white-web-sdk";
|
4
4
|
import type { AppManager } from "./AppManager";
|
@@ -43,6 +43,10 @@ export class AppListeners {
|
|
43
43
|
this.setMainViewScenePathHandler(data.payload);
|
44
44
|
break;
|
45
45
|
}
|
46
|
+
case Events.CursorMove: {
|
47
|
+
this.cursorMoveHandler(data.payload);
|
48
|
+
break;
|
49
|
+
}
|
46
50
|
default:
|
47
51
|
break;
|
48
52
|
}
|
@@ -69,4 +73,8 @@ export class AppListeners {
|
|
69
73
|
private setMainViewScenePathHandler = ({ nextScenePath }: { nextScenePath: string }) => {
|
70
74
|
setViewFocusScenePath(this.manager.mainView, nextScenePath);
|
71
75
|
}
|
76
|
+
|
77
|
+
private cursorMoveHandler = (payload: any) => {
|
78
|
+
emitter.emit("cursorMove", payload);
|
79
|
+
}
|
72
80
|
}
|
package/src/AppManager.ts
CHANGED
@@ -255,10 +255,7 @@ export class AppManager {
|
|
255
255
|
}
|
256
256
|
});
|
257
257
|
}
|
258
|
-
|
259
|
-
this.windowManger.cursorManager?.setRoomMembers(state.roomMembers);
|
260
|
-
this.windowManger.cursorManager?.cleanMemberAttributes(state.roomMembers);
|
261
|
-
}
|
258
|
+
|
262
259
|
this.appProxies.forEach(appProxy => {
|
263
260
|
appProxy.appEmitter.emit("roomStateChange", state);
|
264
261
|
});
|
@@ -313,6 +310,15 @@ export class AppManager {
|
|
313
310
|
}
|
314
311
|
}
|
315
312
|
|
313
|
+
public get uid() {
|
314
|
+
return this.room?.uid || "";
|
315
|
+
}
|
316
|
+
|
317
|
+
public findMemberByUid = (uid: string) => {
|
318
|
+
const roomMembers = this.room?.state.roomMembers;
|
319
|
+
return roomMembers?.find(member => member.payload?.uid === uid);
|
320
|
+
}
|
321
|
+
|
316
322
|
public safeSetAttributes(attributes: any) {
|
317
323
|
this.windowManger.safeSetAttributes(attributes);
|
318
324
|
}
|
@@ -423,6 +429,7 @@ export class AppManager {
|
|
423
429
|
return appProxy.onReconnected();
|
424
430
|
});
|
425
431
|
await Promise.all(reconnected);
|
432
|
+
emitter.emit("onReconnected");
|
426
433
|
}
|
427
434
|
|
428
435
|
public notifyContainerRectUpdate(rect: TeleBoxRect) {
|
package/src/AppProxy.ts
CHANGED
@@ -24,9 +24,8 @@ import type { SceneState, View, SceneDefinition } from "white-web-sdk";
|
|
24
24
|
import type { AppManager } from "./AppManager";
|
25
25
|
import type { NetlessApp } from "./typings";
|
26
26
|
import type { ReadonlyTeleBox } from "@netless/telebox-insider";
|
27
|
-
import { Base } from "./Base";
|
28
27
|
|
29
|
-
export class AppProxy
|
28
|
+
export class AppProxy {
|
30
29
|
public id: string;
|
31
30
|
public scenePath?: string;
|
32
31
|
public appEmitter: Emittery<AppEmitterEvent>;
|
@@ -37,6 +36,7 @@ export class AppProxy extends Base {
|
|
37
36
|
private appProxies = this.manager.appProxies;
|
38
37
|
private viewManager = this.manager.viewManager;
|
39
38
|
private cameraStore = this.manager.cameraStore;
|
39
|
+
private store = this.manager.store;
|
40
40
|
private kind: string;
|
41
41
|
public isAddApp: boolean;
|
42
42
|
private status: "normal" | "destroyed" = "normal";
|
@@ -44,11 +44,10 @@ export class AppProxy extends Base {
|
|
44
44
|
|
45
45
|
constructor(
|
46
46
|
private params: BaseInsertParams,
|
47
|
-
manager: AppManager,
|
47
|
+
private manager: AppManager,
|
48
48
|
appId: string,
|
49
49
|
isAddApp: boolean
|
50
50
|
) {
|
51
|
-
super(manager);
|
52
51
|
this.kind = params.kind;
|
53
52
|
this.id = appId;
|
54
53
|
this.stateKey = `${this.id}_state`;
|
@@ -118,7 +117,7 @@ export class AppProxy extends Base {
|
|
118
117
|
} else {
|
119
118
|
throw new Error(`[WindowManager]: app load failed ${params.kind} ${params.src}`);
|
120
119
|
}
|
121
|
-
this.
|
120
|
+
this.boxManager.updateManagerRect();
|
122
121
|
if (focus) {
|
123
122
|
this.focusApp();
|
124
123
|
}
|
@@ -130,7 +129,7 @@ export class AppProxy extends Base {
|
|
130
129
|
|
131
130
|
private focusApp() {
|
132
131
|
this.focusBox();
|
133
|
-
this.
|
132
|
+
this.viewManager.switchAppToWriter(this.id);
|
134
133
|
this.store.setMainViewFocusPath();
|
135
134
|
}
|
136
135
|
|
@@ -176,6 +175,9 @@ export class AppProxy extends Base {
|
|
176
175
|
canOperate: this.manager.canOperate,
|
177
176
|
smartPosition: this.isAddApp,
|
178
177
|
});
|
178
|
+
if (this.isAddApp && this.box) {
|
179
|
+
this.store.updateAppState(appId, AppAttributes.ZIndex, this.box.zIndex);
|
180
|
+
}
|
179
181
|
} catch (error: any) {
|
180
182
|
console.error(error);
|
181
183
|
throw new Error(`[WindowManager]: app setup error: ${error.message}`);
|
@@ -198,7 +200,7 @@ export class AppProxy extends Base {
|
|
198
200
|
private afterSetupApp(boxInitState: AppInitState | undefined): void {
|
199
201
|
if (boxInitState) {
|
200
202
|
if (boxInitState.focus && this.scenePath) {
|
201
|
-
this.
|
203
|
+
this.viewManager.switchAppToWriter(this.id);
|
202
204
|
}
|
203
205
|
if (!boxInitState?.x || !boxInitState.y) {
|
204
206
|
this.boxManager.setBoxInitState(this.id);
|
@@ -150,34 +150,6 @@ export class AttributesDelegate {
|
|
150
150
|
}
|
151
151
|
}
|
152
152
|
|
153
|
-
public updateCursor(uid: string, position: Position) {
|
154
|
-
if (!get(this.manager.attributes, [Fields.Cursors])) {
|
155
|
-
this.manager.safeUpdateAttributes([Fields.Cursors], {});
|
156
|
-
}
|
157
|
-
if (!get(this.manager.attributes, [Fields.Cursors, uid])) {
|
158
|
-
this.manager.safeUpdateAttributes([Fields.Cursors, uid], {});
|
159
|
-
}
|
160
|
-
this.manager.safeUpdateAttributes([Fields.Cursors, uid, Fields.Position], position);
|
161
|
-
}
|
162
|
-
|
163
|
-
public updateCursorState(uid: string, cursorState: string | undefined) {
|
164
|
-
if (!get(this.manager.attributes, [Fields.Cursors, uid])) {
|
165
|
-
this.manager.safeUpdateAttributes([Fields.Cursors, uid], {});
|
166
|
-
}
|
167
|
-
this.manager.safeUpdateAttributes(
|
168
|
-
[Fields.Cursors, uid, Fields.CursorState],
|
169
|
-
cursorState
|
170
|
-
);
|
171
|
-
}
|
172
|
-
|
173
|
-
public getCursorState(uid: string) {
|
174
|
-
return get(this.manager.attributes, [Fields.Cursors, uid, Fields.CursorState]);
|
175
|
-
}
|
176
|
-
|
177
|
-
public cleanCursor(uid: string) {
|
178
|
-
this.manager.safeUpdateAttributes([Fields.Cursors, uid], undefined);
|
179
|
-
}
|
180
|
-
|
181
153
|
// TODO 状态中保存一个 SceneName 优化性能
|
182
154
|
public setMainViewFocusPath() {
|
183
155
|
const scenePath = this.getMainViewScenePath();
|
package/src/BoxManager.ts
CHANGED
@@ -1,12 +1,7 @@
|
|
1
|
-
import { callbacks, emitter, WindowManager } from "./index";
|
2
|
-
import { debounce, maxBy } from "lodash";
|
3
1
|
import { AppAttributes, Events, MIN_HEIGHT, MIN_WIDTH } from "./constants";
|
4
|
-
import {
|
5
|
-
|
6
|
-
|
7
|
-
TeleBoxCollector,
|
8
|
-
TeleBoxManager,
|
9
|
-
} from "@netless/telebox-insider";
|
2
|
+
import { callbacks, emitter, WindowManager } from "./index";
|
3
|
+
import { debounce } from "lodash";
|
4
|
+
import { TELE_BOX_STATE, TeleBoxCollector, TeleBoxManager } from "@netless/telebox-insider";
|
10
5
|
import type { AddAppOptions, AppInitState } from "./index";
|
11
6
|
import type {
|
12
7
|
TeleBoxManagerUpdateConfig,
|
@@ -58,12 +53,21 @@ export class BoxManager {
|
|
58
53
|
createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig
|
59
54
|
) {
|
60
55
|
this.teleBoxManager = this.setupBoxManager(createTeleBoxManagerConfig);
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
56
|
+
|
57
|
+
// 使用 _xxx$.reaction 订阅修改的值, 不管有没有 skipUpdate, 修改值都会触发回调
|
58
|
+
this.teleBoxManager._state$.reaction(state => {
|
59
|
+
callbacks.emit("boxStateChange", state);
|
60
|
+
emitter.emit("boxStateChange", state);
|
61
|
+
});
|
62
|
+
|
63
|
+
this.teleBoxManager._darkMode$.reaction(darkMode => {
|
64
|
+
callbacks.emit("darkModeChange", darkMode);
|
66
65
|
});
|
66
|
+
this.teleBoxManager._prefersColorScheme$.reaction(colorScheme => {
|
67
|
+
callbacks.emit("prefersColorSchemeChange", colorScheme);
|
68
|
+
});
|
69
|
+
|
70
|
+
// events.on 的值则会根据 skipUpdate 来决定是否触发回调
|
67
71
|
this.teleBoxManager.events.on("minimized", minimized => {
|
68
72
|
this.manager.safeSetAttributes({ minimized });
|
69
73
|
if (minimized) {
|
@@ -109,12 +113,6 @@ export class BoxManager {
|
|
109
113
|
}
|
110
114
|
}
|
111
115
|
});
|
112
|
-
this.teleBoxManager.events.on("dark_mode", darkMode => {
|
113
|
-
callbacks.emit("darkModeChange", darkMode);
|
114
|
-
});
|
115
|
-
this.teleBoxManager.events.on("prefers_color_scheme", colorScheme => {
|
116
|
-
callbacks.emit("prefersColorSchemeChange", colorScheme);
|
117
|
-
});
|
118
116
|
this.teleBoxManager.events.on("z_index", box => {
|
119
117
|
this.manager.store.updateAppState(box.id, AppAttributes.ZIndex, box.zIndex);
|
120
118
|
});
|
@@ -231,8 +229,7 @@ export class BoxManager {
|
|
231
229
|
}
|
232
230
|
|
233
231
|
public getTopBox(): ReadonlyTeleBox | undefined {
|
234
|
-
|
235
|
-
return maxBy(boxes, "zIndex");
|
232
|
+
return this.teleBoxManager.topBox;
|
236
233
|
}
|
237
234
|
|
238
235
|
public updateBoxState(state?: AppInitState): void {
|
@@ -252,7 +249,7 @@ export class BoxManager {
|
|
252
249
|
);
|
253
250
|
setTimeout(() => {
|
254
251
|
if (state.focus) {
|
255
|
-
this.teleBoxManager.focusBox(box.id, true)
|
252
|
+
this.teleBoxManager.focusBox(box.id, true);
|
256
253
|
}
|
257
254
|
if (state.maximized != null) {
|
258
255
|
this.teleBoxManager.setMaximized(Boolean(state.maximized), true);
|
@@ -309,8 +306,8 @@ export class BoxManager {
|
|
309
306
|
this.teleBoxManager.updateAll(config);
|
310
307
|
}
|
311
308
|
|
312
|
-
public setMaximized(maximized: boolean) {
|
313
|
-
this.teleBoxManager.setMaximized(maximized,
|
309
|
+
public setMaximized(maximized: boolean, skipUpdate = true): void {
|
310
|
+
this.teleBoxManager.setMaximized(maximized, skipUpdate);
|
314
311
|
}
|
315
312
|
|
316
313
|
public setMinimized(minimized: boolean, skipUpdate = true) {
|
package/src/Cursor/Cursor.ts
CHANGED
@@ -1,73 +1,54 @@
|
|
1
|
-
import App from
|
2
|
-
import
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import { Fields } from '../AttributesDelegate';
|
7
|
-
import { get, omit } from 'lodash';
|
8
|
-
import type { Position } from '../AttributesDelegate';
|
1
|
+
import App from "./Cursor.svelte";
|
2
|
+
import { ApplianceMap } from "./icons";
|
3
|
+
import { ApplianceNames } from "white-web-sdk";
|
4
|
+
import { omit } from "lodash";
|
5
|
+
import type { Position } from "../AttributesDelegate";
|
9
6
|
import type { RoomMember } from "white-web-sdk";
|
10
7
|
import type { CursorManager } from "./index";
|
11
8
|
import type { SvelteComponent } from "svelte";
|
12
|
-
import {
|
13
|
-
import type { AppManager } from '../AppManager';
|
9
|
+
import type { AppManager } from "../AppManager";
|
14
10
|
|
15
11
|
export type Payload = {
|
16
|
-
[key: string]: any
|
17
|
-
}
|
18
|
-
|
12
|
+
[key: string]: any;
|
13
|
+
};
|
19
14
|
|
20
|
-
export class Cursor
|
15
|
+
export class Cursor {
|
21
16
|
private member?: RoomMember;
|
22
|
-
private disposer: any;
|
23
17
|
private timer?: number;
|
24
18
|
private component?: SvelteComponent;
|
25
19
|
|
26
20
|
constructor(
|
27
|
-
manager: AppManager,
|
28
|
-
private cursors: any,
|
21
|
+
private manager: AppManager,
|
29
22
|
private memberId: string,
|
30
23
|
private cursorManager: CursorManager,
|
31
24
|
private wrapper?: HTMLElement
|
32
25
|
) {
|
33
|
-
super(manager);
|
34
26
|
this.setMember();
|
35
27
|
this.createCursor();
|
36
|
-
pRetry(() => {
|
37
|
-
this.disposer && this.disposer();
|
38
|
-
if (!this.cursorPosition) {
|
39
|
-
console.warn(`${memberId} not exist`);
|
40
|
-
}
|
41
|
-
this.startReaction();
|
42
|
-
}, { retries: 3 });
|
43
28
|
this.autoHidden();
|
44
29
|
}
|
45
30
|
|
46
|
-
|
47
|
-
|
48
|
-
const
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
const rect = this.cursorManager.wrapperRect;
|
53
|
-
if (this.component && rect) {
|
54
|
-
this.autoHidden();
|
55
|
-
this.moveCursor(cursor, rect, this.manager.mainView);
|
56
|
-
}
|
57
|
-
} else {
|
58
|
-
const focusView = this.cursorManager.focusView;
|
59
|
-
const viewRect = focusView?.divElement?.getBoundingClientRect();
|
60
|
-
const viewCamera = focusView?.camera;
|
61
|
-
if (focusView && viewRect && viewCamera && this.component) {
|
62
|
-
this.autoHidden();
|
63
|
-
this.moveCursor(cursor, viewRect, focusView);
|
64
|
-
}
|
31
|
+
public move = (position: Position) => {
|
32
|
+
if (position.type === "main") {
|
33
|
+
const rect = this.cursorManager.wrapperRect;
|
34
|
+
if (this.component && rect) {
|
35
|
+
this.autoHidden();
|
36
|
+
this.moveCursor(position, rect, this.manager.mainView);
|
65
37
|
}
|
66
|
-
|
67
|
-
|
38
|
+
} else {
|
39
|
+
const focusView = this.cursorManager.focusView;
|
40
|
+
const viewRect = focusView?.divElement?.getBoundingClientRect();
|
41
|
+
const viewCamera = focusView?.camera;
|
42
|
+
if (focusView && viewRect && viewCamera && this.component) {
|
43
|
+
this.autoHidden();
|
44
|
+
this.moveCursor(position, viewRect, focusView);
|
68
45
|
}
|
69
|
-
}
|
70
|
-
}
|
46
|
+
}
|
47
|
+
};
|
48
|
+
|
49
|
+
public leave = () => {
|
50
|
+
this.hide();
|
51
|
+
};
|
71
52
|
|
72
53
|
private moveCursor(cursor: Position, rect: DOMRect, view: any) {
|
73
54
|
const { x, y } = cursor;
|
@@ -128,21 +109,12 @@ export class Cursor extends Base {
|
|
128
109
|
}
|
129
110
|
}
|
130
111
|
|
131
|
-
public get cursorState(): CursorState | undefined {
|
132
|
-
return get(this.cursors, [this.memberId, Fields.CursorState]);
|
133
|
-
}
|
134
|
-
|
135
|
-
public get cursorPosition(): Position | undefined {
|
136
|
-
return get(this.cursors, [this.memberId, Fields.Position]);
|
137
|
-
}
|
138
|
-
|
139
112
|
private autoHidden() {
|
140
113
|
if (this.timer) {
|
141
114
|
clearTimeout(this.timer);
|
142
115
|
}
|
143
116
|
this.timer = window.setTimeout(() => {
|
144
117
|
this.hide();
|
145
|
-
this.store.updateCursorState(this.memberId, CursorState.Leave);
|
146
118
|
}, 1000 * 10); // 10 秒钟自动隐藏
|
147
119
|
}
|
148
120
|
|
@@ -180,7 +152,7 @@ export class Cursor extends Base {
|
|
180
152
|
}
|
181
153
|
|
182
154
|
public setMember() {
|
183
|
-
this.member = this.
|
155
|
+
this.member = this.manager.findMemberByUid(this.memberId);
|
184
156
|
this.updateComponent();
|
185
157
|
}
|
186
158
|
|
@@ -189,16 +161,19 @@ export class Cursor extends Base {
|
|
189
161
|
}
|
190
162
|
|
191
163
|
public destroy() {
|
192
|
-
this.disposer && this.disposer();
|
193
164
|
if (this.component) {
|
194
165
|
this.component.$destroy();
|
195
166
|
}
|
196
167
|
this.cursorManager.cursorInstances.delete(this.memberId);
|
168
|
+
if (this.timer) {
|
169
|
+
clearTimeout(this.timer);
|
170
|
+
}
|
197
171
|
}
|
198
172
|
|
199
173
|
public hide() {
|
200
174
|
if (this.component) {
|
201
175
|
this.component.$set({ visible: false });
|
176
|
+
this.destroy();
|
202
177
|
}
|
203
178
|
}
|
204
179
|
}
|