Skip to content

Commit 86a3280

Browse files
committed
fix(toolbar): toolbar
1.Optimized the toolbar position of the toolbar and more buttons when Luckysheet does not occupy the full screen 2.Add sponsors fix dream-num#414
1 parent 57f41e8 commit 86a3280

File tree

5 files changed

+48
-6
lines changed

5 files changed

+48
-6
lines changed

README-zh.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ npm run build
136136
## 合作项目
137137

138138
- [鲁班h5](https://github.com/ly525/luban-h5)
139-
- [excelize](https://github.com/360EntSecGroup-Skylar/excelize)
140139
- [h5-Dooring](https://github.com/MrXujiang/h5-Dooring)
141140
- [Furion](https://gitee.com/monksoul/Furion)
142141

@@ -195,6 +194,9 @@ Luckysheet是MIT许可的开源项目,其持续稳定的开发离不开这些
195194
- Quentin ¥ 20
196195
- 周宇凡 ¥ 100
197196
- *超 ¥ 10
197+
- 维宁 ¥ 100
198+
- hyy ¥ 20
199+
- 雨亭寒江月 ¥ 50
198200

199201
## 贡献者和感谢
200202

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ npm run build
129129
## Partner project
130130

131131
- [luban-h5](https://github.com/ly525/luban-h5)
132-
- [excelize](https://github.com/360EntSecGroup-Skylar/excelize)
133132
- [h5-Dooring](https://github.com/MrXujiang/h5-Dooring)
134133
- [Furion](https://gitee.com/monksoul/Furion)
135134

@@ -179,6 +178,9 @@ Funds donated via Patreon go directly to support mengshukeji's work on Luckyshee
179178
- Quentin ¥ 20
180179
- 周宇凡 ¥ 100
181180
- *超 ¥ 10
181+
- 维宁 ¥ 100
182+
- hyy ¥ 20
183+
- 雨亭寒江月 ¥ 50
182184

183185
## Authors and acknowledgment
184186

docs/about/sponsor.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,6 @@ Funds donated via Patreon go directly to support mengshukeji's work on Luckyshee
4646
- Quentin ¥ 20
4747
- 周宇凡 ¥ 100
4848
- *超 ¥ 10
49+
- 维宁 ¥ 100
50+
- hyy ¥ 20
51+
- 雨亭寒江月 ¥ 50

docs/zh/about/sponsor.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,7 @@ Luckysheet是MIT许可的开源项目,其持续稳定的开发离不开这些
4545
- *旭 ¥ 10
4646
- Quentin ¥ 20
4747
- 周宇凡 ¥ 100
48-
- *超 ¥ 10
48+
- *超 ¥ 10
49+
- 维宁 ¥ 100
50+
- hyy ¥ 20
51+
- 雨亭寒江月 ¥ 50

src/controllers/resize.js

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Store from '../store';
55
import locale from '../locale/locale';
66
import sheetmanage from './sheetmanage';
77
import tooltip from '../global/tooltip'
8+
import { $$ } from "../utils/util";
89

910
let gridW = 0,
1011
gridH = 0;
@@ -100,13 +101,15 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) {
100101
</div>
101102
</div>
102103
</div>`,
103-
morediv = '<div id="luckysheet-icon-morebtn-div" class="luckysheet-wa-editor" style="position:absolute;top:'+ (Store.infobarHeight + Store.toolbarHeight + $("#" + Store.container).offset().top + $("body").scrollTop()) +'px; right:0px;z-index:1003;padding:5.5px;display:none;height:auto;white-space:initial;"></div>';
104+
// Add style left:$$('.luckysheet') left, when the worksheet does not fill the full screen
105+
morediv = '<div id="luckysheet-icon-morebtn-div" class="luckysheet-wa-editor" style="position:absolute;top:'+ (Store.infobarHeight + Store.toolbarHeight + $("#" + Store.container).offset().top + $("body").scrollTop()) +'px;right:0px;z-index:1003;padding:5.5px;visibility:hidden;height:auto;white-space:initial;"></div>';
104106

105107
if($("#luckysheet-icon-morebtn-div").length == 0){
106108
$("body").append(morediv);
107109
}
108110

109-
$("#luckysheet-icon-morebtn-div").hide();
111+
// $("#luckysheet-icon-morebtn-div").hide();
112+
$$("#luckysheet-icon-morebtn-div").style.visibility = 'hidden';
110113
// $("#luckysheet-icon-morebtn-div > div").appendTo($("#luckysheet-wa-editor"));
111114

112115
$("#luckysheet-icon-morebtn-div > div").each(function(){
@@ -158,8 +161,31 @@ export default function luckysheetsizeauto(isRefreshCanvas=true) {
158161

159162
$("#luckysheet-wa-editor").append(morebtn);
160163
$("#luckysheet-icon-morebtn").click(function(){
164+
165+
//When resize, change the width of the more button container in real time
166+
$$('#luckysheet-icon-morebtn-div').style.left = '';//reset
167+
168+
const containerLeft = $$('#luckysheet').getBoundingClientRect().left;
169+
const morebtnLeft = $$('#luckysheet-icon-morebtn-div').getBoundingClientRect().left;//get real left info
170+
171+
if(morebtnLeft < containerLeft){
172+
$$('#luckysheet-icon-morebtn-div').style.left = containerLeft + 'px';
173+
}
174+
161175
let right = $(window).width() - $("#luckysheet-icon-morebtn").offset().left - $("#luckysheet-icon-morebtn").width()+ $("body").scrollLeft();
162-
$("#luckysheet-icon-morebtn-div").toggle().css("right", right < 0 ? 0 : right);
176+
177+
178+
// $("#luckysheet-icon-morebtn-div").toggle().css("right", right < 0 ? 0 : right);
179+
180+
// use native js operation
181+
$$('#luckysheet-icon-morebtn-div').style.right = right < 0 ? 0 : right + 'px';
182+
183+
// change to visibility,morebtnLeft will get the actual value
184+
if($$('#luckysheet-icon-morebtn-div').style.visibility === 'hidden'){
185+
$$('#luckysheet-icon-morebtn-div').style.visibility = 'visible';
186+
}else{
187+
$$('#luckysheet-icon-morebtn-div').style.visibility = 'hidden';
188+
}
163189

164190
let $txt = $(this).find(".luckysheet-toolbar-menu-button-caption");
165191
if($txt.text().indexOf(locale_toolbar.toolMore) > -1){
@@ -558,6 +584,12 @@ export function menuToolBarWidth() {
558584
}
559585

560586
});
587+
588+
//If the container does not occupy the full screen, we need to subtract the left margin
589+
const containerLeft = $('#' + Store.container).offset().left;
590+
toobarWidths.forEach((item,i)=>{
591+
toobarWidths[i] -= containerLeft;
592+
})
561593

562594
}
563595

0 commit comments

Comments
 (0)