A web-based drawing app
git clone git://soophie.de/outline
1
*{margin:0;padding:0;font-family:Roboto,sans-serif;box-sizing:border-box}:focus,:hover{outline:0}html{position:relative;overflow-x:hidden;min-height:100vh}body{width:100%;font-size:14px;min-height:100vh}img{pointer-events:none;user-select:none}input{-webkit-appearance:none}button{user-select:none;cursor:pointer}.hidden{display:none!important}.ico{font-family:'Material Icons';font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:'liga';user-select:none;pointer-events:none}*{-webkit-tap-highlight-color:transparent}body,html{overflow:hidden}#canvas,#overlay,.controls{position:fixed;top:0;left:0;right:0;bottom:0}#overlay{pointer-events:none}.badge{display:inline-block;margin-top:-1px;margin-left:5px;padding:2px 4px;border-radius:2px;font-weight:500;font-size:12px;color:#fff!important}.badge.prime{background:#0372EF}.badge.beta{background:#388E3C}.controls{pointer-events:none}.controls .notification{top:30px;position:fixed;display:flex;justify-content:center;width:100%;opacity:0}.controls .notification p{display:inline-block;padding:10px 24px;border-radius:999px;background:#24292E;color:#fff;opacity:.95;user-select:none;pointer-events:none}.controls .ad{position:fixed;width:400px;height:150px;border-radius:4px;background:#EEE;bottom:40px;right:40px;pointer-events:all}.controls .hotbar{display:flex;position:fixed;left:calc(50% - 216px);bottom:30px;pointer-events:all;z-index:-1}.controls .hotbar .color{margin:6px;width:60px;height:60px;border-radius:30px;background:#EEE;cursor:pointer;transition:transform .2s;transform:scale(.9)}.controls .hotbar .color:not(.active):hover{transform:scale(1)}.controls .hotbar .color.focus{transform:scale(1)}.controls .hotbar .color.active{transform:scale(1.1)}.controls .scale-modal{top:40px;left:calc(50% - 200px);width:400px;height:60px}.controls .scale-modal input[type=range]{-webkit-appearance:none;width:calc(400px - 54px);margin-top:21px;margin-left:27px;height:6px;background:#EEE;border:none;border-radius:4px}.controls .scale-modal input[type=range]::-webkit-slider-runnable-track{-webkit-appearance:none}.controls .scale-modal input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;height:20px;width:20px;margin-top:0;background:#9E9E9E;border-radius:10px;cursor:pointer}.controls .scale-modal input[type=range]::-webkit-slider-thumb:hover{background:#757575}.controls .clear-modal{top:calc(50% - 75px);left:calc(50% - 200px);width:400px;height:150px;display:grid;padding:30px 10px 10px 10px}.controls .clear-modal .text-clear{font-size:20px;width:380px;height:px;text-align:center;align-items:center}.controls .clear-modal .align{display:flex;margin-top:auto}.controls .clear-modal .align .btn-cancel{width:185px;height:50px;border:none;border-radius:3px;background-color:#F5F5F5;font-size:17px}.controls .clear-modal .align .btn-cancel:hover{background-color:#E0E0E0}.controls .clear-modal .align .btn-apply{width:185px;height:50px;border:none;border-radius:3px;border-color:grey;background-color:#F5F5F5;margin-left:10px;font-size:17px}.controls .clear-modal .align .btn-apply:hover{background-color:#E0E0E0}.controls .capture-modal{top:calc(50% - 250px);left:calc(50% - 200px);width:400px;height:500px;display:grid}.controls .capture-modal .text-save{font-size:20px;width:380px;height:px;text-align:center;align-items:center;margin-top:20px}.controls .capture-modal .preview{height:250px;background:#F5F5F5;border:1px solid #f1f1f1;border-radius:3px;margin-top:20px;margin-left:20px;margin-right:20px}.controls .capture-modal .action-file{border-radius:3px;border:2px solid #f1f1f1;height:50px;margin-top:10px;margin-left:20px;margin-right:20px;padding:0 0 0 10px;font-size:15px}.controls .capture-modal .align{display:flex;margin-top:auto;margin-bottom:20px}.controls .capture-modal .align .btn-cancel{width:170px;height:50px;border:none;border-radius:3px;background-color:#F5F5F5;font-size:17px;margin-left:20px}.controls .capture-modal .align .btn-cancel:hover{background-color:#E0E0E0}.controls .capture-modal .align .btn-apply{width:170px;height:50px;border:none;border-radius:3px;border-color:grey;background-color:#F5F5F5;margin-left:20px;font-size:17px}.controls .capture-modal .align .btn-apply:hover{background-color:#E0E0E0}.controls .toolbar{top:20px;left:20px}.controls .actionbar{top:20px;right:20px}.controls .actionbar,.controls .toolbar{display:flex;position:fixed;pointer-events:all}.controls .actionbar .action,.controls .actionbar .tool,.controls .toolbar .action,.controls .toolbar .tool{width:44px;height:44px;padding:10px;margin-left:8px;border-radius:22px;cursor:pointer}.controls .actionbar .action:hover,.controls .actionbar .tool:hover,.controls .toolbar .action:hover,.controls .toolbar .tool:hover{background:rgba(250,250,250,.95)}.controls .actionbar .action:hover.ripple:not(.active).ripple-active,.controls .actionbar .tool:hover.ripple:not(.active).ripple-active,.controls .toolbar .action:hover.ripple:not(.active).ripple-active,.controls .toolbar .tool:hover.ripple:not(.active).ripple-active{background:rgba(245,245,245,.95)}.controls .actionbar .action:hover.ripple.active.ripple-active,.controls .actionbar .tool:hover.ripple.active.ripple-active,.controls .toolbar .action:hover.ripple.active.ripple-active,.controls .toolbar .tool:hover.ripple.active.ripple-active{background:rgba(233,233,233,.95)}.controls .actionbar .action.active,.controls .actionbar .tool.active,.controls .toolbar .action.active,.controls .toolbar .tool.active{background:rgba(238,238,238,.95)}.controls .actionbar .action i.ico,.controls .actionbar .tool i.ico,.controls .toolbar .action i.ico,.controls .toolbar .tool i.ico{color:#424242}.colors-modal{flex-wrap:wrap;min-width:410px;width:410px;max-width:410px;padding:30px!important;top:calc(50% - 421px);left:calc(50% - 205px);display:flex;gap:12px}.colors-modal .color{width:60px;height:60px;border-radius:30px;background:#EEE;cursor:pointer;transition:transform .2s;transform:scale(.9)}.colors-modal .color:not(.active):hover{transform:scale(1)}.colors-modal .color.active{transform:scale(1.1)}.colors-modal .color.focus{transform:scale(1)}.multiplayer-modal{top:75px;right:120px}.account-modal{top:75px;right:70px}.settings-modal{top:75px;right:20px}.device-modal{top:100px;right:320px}.language-modal{top:100px;right:860px}.settings-modal{top:75px;right:20px}.modal{width:250px;position:fixed;background:#fff;border:1px solid #F1F1F1;border-radius:4px;padding:6px 0;pointer-events:all;overflow:hidden;z-index:-1;display:flex}.modal .main{width:248px;min-width:248px;7max-width:248px}.modal ul.tab-list{width:248px;min-width:248px;max-width:248px}.modal .header{display:flex;margin-bottom:3px}.modal .header .back{margin:10px;margin-top:15px;margin-right:3px;width:36px;height:36px;border-radius:18px;padding:6px;padding-left:5px;cursor:pointer}.modal .header .back i.ico{color:#424242}.modal .header .back:hover{background:#FAFAFA}.modal .header .back.ripple.ripple-active{background:#f5f5f5}.modal .header .info{display:flex;flex-direction:column;margin-top:15px}.modal .header .info p{display:flex;align-items:center;font-weight:500;color:#616161;user-select:none;pointer-events:none}.modal .header .info span{display:block;margin-top:3px;font-size:12px;color:#9E9E9E;user-select:none;pointer-events:none}.modal ul.item-list .separator{margin:6px 0;width:100%;height:1px;background:#F1F1F1}.modal ul.item-list li.caption{padding:2px 15px;padding-top:12px;list-style:none}.modal ul.item-list li.caption p{color:#9E9E9E;user-select:none;pointer-events:none}.modal ul.item-list li.item{display:flex;align-items:center;padding:15px;cursor:pointer}.modal ul.item-list li.item.empty p{display:block;width:100%;color:#9E9E9E;text-align:center;user-select:none;pointer-events:none}.modal ul.item-list li.item:not(.active):not(.inactive):hover{background:#FAFAFA}.modal ul.item-list li.item:not(.active):not(.inactive).ripple.ripple-active{background:#f5f5f5}.modal ul.item-list li.item i.ico{color:#424242;user-select:none;pointer-events:none}.modal ul.item-list li.item i.lang{display:flex;justify-content:center;align-items:center;font-style:normal;font-weight:600;width:24px;height:24px;color:#424242;user-select:none;pointer-events:none}.modal ul.item-list li.item .info{display:flex;flex-direction:column;margin-left:10px;max-width:calc(100% - 24px - 10px)}.modal ul.item-list li.item .info p{display:flex;align-items:center;font-weight:500;color:#616161;user-select:none;pointer-events:none}.modal ul.item-list li.item .info span{display:block;margin-top:3px;font-size:12px;color:#9E9E9E;user-select:none;pointer-events:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.modal ul.item-list li.item.active{background:#EEE}.modal ul.item-list li.item.active.ripple.ripple-active{background:#e9e9e9}.modal ul.item-list li.item.inactive i.ico{color:#9E9E9E}.modal ul.item-list li.item.inactive .info p{color:#9E9E9E}.tooltip{position:relative;display:flex;justify-content:center;align-items:center}.tooltip:hover::before{opacity:.95;transition-delay:.6s}.tooltip:hover::after{opacity:.95;transition-delay:.6s}.tooltip::after{display:flex;opacity:0;content:attr(data-title);justify-content:center;align-items:center;position:absolute;background:#24292E;color:#fff;min-height:24px;padding:0 12px;border-radius:999px;font-size:12px;top:auto;bottom:-70%;white-space:nowrap;z-index:9999;pointer-events:none}.tooltip.up::before{top:calc(-90% + 26px);bottom:auto;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #24292E;border-bottom:none}.tooltip.up::after{top:-60%;bottom:auto}.tooltip.down::before{top:auto;bottom:calc(-90% + 26px);border-left:6px solid transparent;border-right:6px solid transparent;border-top:none;border-bottom:6px solid #24292E}.tooltip.down::after{top:auto;bottom:-60%}1
\ No newline at end of file1
*{margin:0;padding:0;font-family:Roboto,sans-serif;box-sizing:border-box}:focus,:hover{outline:0}html{position:relative;overflow-x:hidden;min-height:100vh}body{width:100%;font-size:14px;min-height:100vh}img{pointer-events:none;user-select:none}input{-webkit-appearance:none}button{user-select:none;cursor:pointer}.hidden{display:none!important}.ico{font-family:'Material Icons';font-weight:400;font-style:normal;font-size:24px;display:inline-block;line-height:1;text-transform:none;letter-spacing:normal;word-wrap:normal;white-space:nowrap;direction:ltr;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility;-moz-osx-font-smoothing:grayscale;font-feature-settings:'liga';user-select:none;pointer-events:none}*{-webkit-tap-highlight-color:transparent}body,html{overflow:hidden}#canvas,#overlay,.controls{position:fixed;top:0;left:0;right:0;bottom:0}#overlay{pointer-events:none}.badge{display:inline-block;margin-top:-1px;margin-left:5px;padding:2px 4px;border-radius:2px;font-weight:500;font-size:12px;color:#fff!important}.badge.prime{background:#0372EF}.badge.beta{background:#388E3C}.controls{pointer-events:none}.controls .notification{top:30px;position:fixed;display:flex;justify-content:center;width:100%;opacity:0}.controls .notification p{display:inline-block;padding:10px 24px;border-radius:999px;background:#24292E;color:#fff;opacity:.95;user-select:none;pointer-events:none}.controls .hotbar{display:flex;position:fixed;left:calc(50% - 216px);bottom:30px;z-index:-1}.controls .hotbar .color{margin:6px;width:60px;height:60px;border-radius:30px;background:#EEE;cursor:pointer;transition:transform .2s;transform:scale(.9);pointer-events:all}.controls .hotbar .color:not(.active):hover{transform:scale(1)}.controls .hotbar .color.focus{transform:scale(1)}.controls .hotbar .color.active{transform:scale(1.1)}.controls .scale-modal{top:40px;left:calc(50% - 200px);width:400px;height:60px}.controls .scale-modal input[type=range]{-webkit-appearance:none;width:calc(400px - 54px);margin-top:21px;margin-left:27px;height:6px;background:#EEE;border:none;border-radius:4px}.controls .scale-modal input[type=range]::-webkit-slider-runnable-track{-webkit-appearance:none}.controls .scale-modal input[type=range]::-webkit-slider-thumb{-webkit-appearance:none;height:20px;width:20px;margin-top:0;background:#9E9E9E;border-radius:10px;cursor:pointer}.controls .scale-modal input[type=range]::-webkit-slider-thumb:hover{background:#757575}.controls .clear-modal{top:calc(50% - 75px);left:calc(50% - 200px);width:400px;height:150px;display:grid;padding:30px 10px 10px 10px}.controls .clear-modal .text-clear{font-size:20px;width:380px;text-align:center;align-items:center}.controls .clear-modal .align{display:flex;margin-top:auto}.controls .clear-modal .align .btn-cancel{width:185px;height:50px;border:none;border-radius:3px;background-color:#F5F5F5;font-size:17px}.controls .clear-modal .align .btn-cancel:hover{background-color:#E0E0E0}.controls .clear-modal .align .btn-apply{width:185px;height:50px;border:none;border-radius:3px;border-color:grey;background-color:#F5F5F5;margin-left:10px;font-size:17px}.controls .clear-modal .align .btn-apply:hover{background-color:#E0E0E0}.controls .capture-modal{top:calc(50% - 250px);left:calc(50% - 200px);width:400px;height:500px;display:grid}.controls .capture-modal .text-save{font-size:20px;width:380px;height:px;text-align:center;align-items:center;margin-top:20px}.controls .capture-modal .preview{height:250px;background:#F5F5F5;border:1px solid #f1f1f1;border-radius:3px;margin-top:20px;margin-left:20px;margin-right:20px}.controls .capture-modal .action-file{border-radius:3px;border:2px solid #f1f1f1;height:50px;margin-top:10px;margin-left:20px;margin-right:20px;padding:0 0 0 10px;font-size:15px}.controls .capture-modal .align{display:flex;margin-top:auto;margin-bottom:20px}.controls .capture-modal .align .btn-cancel{width:170px;height:50px;border:none;border-radius:3px;background-color:#F5F5F5;font-size:17px;margin-left:20px}.controls .capture-modal .align .btn-cancel:hover{background-color:#E0E0E0}.controls .capture-modal .align .btn-apply{width:170px;height:50px;border:none;border-radius:3px;border-color:grey;background-color:#F5F5F5;margin-left:20px;font-size:17px}.controls .capture-modal .align .btn-apply:hover{background-color:#E0E0E0}.controls .toolbar{top:20px;left:20px}.controls .actionbar{top:20px;right:20px}.controls .actionbar,.controls .toolbar{display:flex;position:fixed}.controls .actionbar .action,.controls .actionbar .tool,.controls .toolbar .action,.controls .toolbar .tool{width:44px;height:44px;padding:10px;margin-left:8px;border-radius:22px;cursor:pointer;pointer-events:all}.controls .actionbar .action:hover,.controls .actionbar .tool:hover,.controls .toolbar .action:hover,.controls .toolbar .tool:hover{background:rgba(250,250,250,.95)}.controls .actionbar .action:hover.ripple:not(.active).ripple-active,.controls .actionbar .tool:hover.ripple:not(.active).ripple-active,.controls .toolbar .action:hover.ripple:not(.active).ripple-active,.controls .toolbar .tool:hover.ripple:not(.active).ripple-active{background:rgba(245,245,245,.95)}.controls .actionbar .action:hover.ripple.active.ripple-active,.controls .actionbar .tool:hover.ripple.active.ripple-active,.controls .toolbar .action:hover.ripple.active.ripple-active,.controls .toolbar .tool:hover.ripple.active.ripple-active{background:rgba(233,233,233,.95)}.controls .actionbar .action.active,.controls .actionbar .tool.active,.controls .toolbar .action.active,.controls .toolbar .tool.active{background:rgba(238,238,238,.95)}.controls .actionbar .action i.ico,.controls .actionbar .tool i.ico,.controls .toolbar .action i.ico,.controls .toolbar .tool i.ico{color:#424242}.colors-modal{flex-wrap:wrap;min-width:410px;width:410px;max-width:410px;padding:30px!important;top:calc(50% - 421px);left:calc(50% - 205px);display:flex;gap:12px}.colors-modal .color{width:60px;height:60px;border-radius:30px;background:#EEE;cursor:pointer;transition:transform .2s;transform:scale(.9)}.colors-modal .color:not(.active):hover{transform:scale(1)}.colors-modal .color.active{transform:scale(1.1)}.colors-modal .color.focus{transform:scale(1)}.multiplayer-modal{top:75px;right:120px}.account-modal{top:75px;right:70px}.settings-modal{top:75px;right:20px}.device-modal{top:100px;right:320px}.language-modal{top:100px;right:860px}.settings-modal{top:75px;right:20px}.modal{width:250px;position:fixed;background:#fff;border:1px solid #F1F1F1;border-radius:4px;padding:6px 0;pointer-events:all;overflow:hidden;z-index:-1;display:flex}.modal .main{width:248px;min-width:248px;7max-width:248px}.modal ul.tab-list{width:248px;min-width:248px;max-width:248px}.modal .header{display:flex;margin-bottom:3px}.modal .header .back{margin:10px;margin-top:15px;margin-right:3px;width:36px;height:36px;border-radius:18px;padding:6px;padding-left:5px;cursor:pointer}.modal .header .back i.ico{color:#424242}.modal .header .back:hover{background:#FAFAFA}.modal .header .back.ripple.ripple-active{background:#f5f5f5}.modal .header .info{display:flex;flex-direction:column;margin-top:15px}.modal .header .info p{display:flex;align-items:center;font-weight:500;color:#616161;user-select:none;pointer-events:none}.modal .header .info span{display:block;margin-top:3px;font-size:12px;color:#9E9E9E;user-select:none;pointer-events:none}.modal ul.item-list .separator{margin:6px 0;width:100%;height:1px;background:#F1F1F1}.modal ul.item-list li.caption{padding:2px 15px;padding-top:12px;list-style:none}.modal ul.item-list li.caption p{color:#9E9E9E;user-select:none;pointer-events:none}.modal ul.item-list li.item{display:flex;align-items:center;padding:15px;cursor:pointer}.modal ul.item-list li.item.empty p{display:block;width:100%;color:#9E9E9E;text-align:center;user-select:none;pointer-events:none}.modal ul.item-list li.item:not(.active):not(.inactive):hover{background:#FAFAFA}.modal ul.item-list li.item:not(.active):not(.inactive).ripple.ripple-active{background:#f5f5f5}.modal ul.item-list li.item i.ico{color:#424242;user-select:none;pointer-events:none}.modal ul.item-list li.item i.lang{display:flex;justify-content:center;align-items:center;font-style:normal;font-weight:600;width:24px;height:24px;color:#424242;user-select:none;pointer-events:none}.modal ul.item-list li.item .info{display:flex;flex-direction:column;margin-left:10px;max-width:calc(100% - 24px - 10px)}.modal ul.item-list li.item .info p{display:flex;align-items:center;font-weight:500;color:#616161;user-select:none;pointer-events:none}.modal ul.item-list li.item .info span{display:block;margin-top:3px;font-size:12px;color:#9E9E9E;user-select:none;pointer-events:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.modal ul.item-list li.item.active{background:#EEE}.modal ul.item-list li.item.active.ripple.ripple-active{background:#e9e9e9}.modal ul.item-list li.item.inactive i.ico{color:#9E9E9E}.modal ul.item-list li.item.inactive .info p{color:#9E9E9E}.tooltip{position:relative;display:flex;justify-content:center;align-items:center}.tooltip:hover::before{opacity:.95;transition-delay:.6s}.tooltip:hover::after{opacity:.95;transition-delay:.6s}.tooltip::after{display:flex;opacity:0;content:attr(data-title);justify-content:center;align-items:center;position:absolute;background:#24292E;color:#fff;min-height:24px;padding:0 12px;border-radius:999px;font-size:12px;top:auto;bottom:-70%;white-space:nowrap;z-index:9999;pointer-events:none}.tooltip.up::before{top:calc(-90% + 26px);bottom:auto;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #24292E;border-bottom:none}.tooltip.up::after{top:-60%;bottom:auto}.tooltip.down::before{top:auto;bottom:calc(-90% + 26px);border-left:6px solid transparent;border-right:6px solid transparent;border-top:none;border-bottom:6px solid #24292E}.tooltip.down::after{top:auto;bottom:-60%}1
\ No newline at end of file
22
<div class="notification">23
<p class="content"></p>24
</div>25
<div class="ad hidden"></div>25
<div class="toolbar">27
<div class="tool ripple tooltip" data-lang="tool.colors" data-type="tooltip" data-title="Colors" data-modal="colors" onclick="toggle_modal(this)">26
<div class="tool ripple tooltip" data-lang="tool.colors" data-type="tooltip" data-title="Colors" data-event="toggle.modal" data-code="colors">27
<i class="ico">palette</i>28
</div>30
<div class="tool ripple tooltip" data-lang="tool.scale" data-type="tooltip" data-title="Scale" data-modal="scale" onclick="toggle_modal(this)">29
<div class="tool ripple tooltip" data-lang="tool.scale" data-type="tooltip" data-title="Scale" data-event="toggle.modal" data-code="scale">30
<i class="ico">bubble_chart</i>31
</div>33
<div class="tool ripple tooltip" data-lang="tool.clear" data-type="tooltip" data-title="Clear" data-modal="clear" onclick="toggle_modal(this)">32
<div class="tool ripple tooltip" data-lang="tool.clear" data-type="tooltip" data-title="Clear" data-event="toggle.modal" data-code="clear">33
<i class="ico">delete</i>34
</div>36
<div class="tool ripple tooltip" data-lang="tool.capture" data-type="tooltip" data-title="Capture" data-modal="capture" onclick="toggle_modal(this)">35
<div class="tool ripple tooltip" data-lang="tool.capture" data-type="tooltip" data-title="Capture" data-event="toggle.modal" data-code="capture">36
<i class="ico">crop_free</i>37
</div>38
</div>39
<div class="actionbar">41
<div class="action ripple tooltip" data-lang="action.multiplayer" data-type="tooltip" data-title="Multiplayer" data-modal="multiplayer" onclick="toggle_modal(this)">40
<div class="action ripple tooltip" data-lang="action.multiplayer" data-type="tooltip" data-title="Multiplayer" data-event="toggle.modal" data-code="multiplayer">41
<i class="ico">dns</i>42
</div>44
<div class="action ripple tooltip" data-lang="action.account" data-type="tooltip" data-title="Account" data-modal="account" onclick="toggle_modal(this)">43
<div class="action ripple tooltip" data-lang="action.account" data-type="tooltip" data-title="Account" data-event="toggle.modal" data-code="account">44
<i class="ico">person</i>45
</div>47
<div class="action ripple tooltip" data-lang="action.settings" data-type="tooltip" data-title="Settings" data-modal="settings" onclick="toggle_modal(this)">46
<div class="action ripple tooltip" data-lang="action.settings" data-type="tooltip" data-title="Settings" data-event="toggle.modal" data-code="settings">47
<i class="ico">settings</i>48
</div>49
</div>
113
<div class="color"></div>114
</div>115
<div class="modal scale-modal hidden">117
<input type="range" min="2" max="50" value="14" step="1">118
<div class="modal window"></div>116
<input class="scale" type="range" min="2" max="50" value="14" step="1">117
</div>118
<div class="modal clear-modal hidden">119
<p class="text-clear">Do you want to clear the screen?</p>120
<div class="align">123
<button class="btn btn-cancel" data-modal="clear" onclick="toggle_modal(this)">No</button>124
<button class="btn btn-apply" onclick="clear_screen()">Yes</button>121
<button class="btn btn-cancel" data-event="close.modal">No</button>122
<button class="btn btn-apply" data-event="clear">Yes</button>123
</div>124
</div>125
<div class="modal capture-modal hidden">126
<p class="text-save">Do you want to save this screen?</p>127
<div class="preview"></div>130
<input type="text" class="action-file" maxlength="40" spellcheck="false" autocomplete="off" placeholder="Choose a name">128
<input type="text" class="action-file" maxlength="40" spellcheck="false" autocomplete="off" placeholder="Choose a name">129
<div class="align">132
<button class="btn btn-cancel" data-modal="capture" onclick="toggle_modal(this)">No</button>133
<button class="btn btn-apply" onclick="">Yes</button>130
<button class="btn btn-cancel" data-event="close.modal">No</button>131
<button class="btn btn-apply">Yes</button>132
</div>133
</div>134
<div class="modal multiplayer-modal hidden">
156
</div>157
</li>158
<li class="separator"></li>161
<li class="item ripple" data-tab="customize" onclick="open_tab(this)">159
<li class="item ripple" data-event="open.tab" data-code="customize">160
<i class="ico">build</i>161
<div class="info">162
<p data-lang="multiplayer.customize">Customize</p>
182
<ul class="tab-list">183
<li class="tab customize-tab">184
<div class="header">187
<div class="back ripple" onclick="close_tab(this)">185
<div class="back ripple" data-event="close.tab">186
<i class="ico">keyboard_arrow_left</i>187
</div>188
<div class="info">
270
<div class="modal settings-modal hidden">271
<div class="main">272
<ul class="item-list">275
<li class="item ripple" data-tab="help" onclick="open_tab(this)">273
<li class="item ripple" data-event="open.tab" data-code="help">274
<i class="ico">help</i>275
<div class="info">276
<p data-lang="setting.help">Help</p>277
<span data-lang="setting.help.info">Learn more about the features</span>278
</div>279
</li>282
<li class="item ripple" data-tab="language" onclick="open_tab(this)">280
<li class="item ripple" data-event="open.tab" data-code="language">281
<i class="ico">language</i>282
<div class="info">283
<p data-lang="setting.language" data-badge="true">Language<b class="badge beta">Beta</b></p>284
<span data-lang="setting.language.info">Choose preferred language</span>285
</div>286
</li>289
<li class="item ripple" data-tab="device" onclick="open_tab(this)">287
<li class="item ripple" data-event="open.tab" data-code="device">288
<i class="ico">power</i>289
<div class="info">290
<p data-lang="setting.input-device">Input Device</p>291
<span data-lang="setting.input-device.info">Choose preferred input device</span>292
</div>293
</li>296
<li class="item ripple" data-tab="appearance" onclick="open_tab(this)">294
<li class="item ripple" data-event="open.tab" data-code="appearance">295
<i class="ico">brush</i>296
<div class="info">297
<p data-lang="setting.appearance">Appearance</p>
303
<ul class="tab-list">304
<li class="tab help-tab hidden">305
<div class="header">308
<div class="back ripple" onclick="close_tab(this)">306
<div class="back ripple" data-event="close.tab">307
<i class="ico">keyboard_arrow_left</i>308
</div>309
<div class="info">
330
</li>331
<li class="tab language-tab hidden">332
<div class="header">335
<div class="back ripple" onclick="close_tab(this)">333
<div class="back ripple" data-event="close.tab">334
<i class="ico">keyboard_arrow_left</i>335
</div>336
<div class="info">
356
</li>357
<li class="tab device-tab hidden">358
<div class="header">361
<div class="back ripple" onclick="close_tab(this)">359
<div class="back ripple" data-event="close.tab">360
<i class="ico">keyboard_arrow_left</i>361
</div>362
<div class="info">
397
</li>398
<li class="tab appearance-tab hidden">399
<div class="header">402
<div class="back ripple" onclick="close_tab(this)">400
<div class="back ripple" data-event="close.tab">401
<i class="ico">keyboard_arrow_left</i>402
</div>403
<div class="info">
1
const DEVICE_PIXEL_RATIO = window.devicePixelRatio || 1;3
import { COLORS } from '../constant.js';5
let active;6
let point_list = [];7
let width;8
let height;9
let ratio;10
let backing_store_ratio;12
let canvas;13
let overlay;14
let memory;15
let g;16
let o;17
let m;19
function init() {20
width = window.innerWidth;21
height = window.innerHeight;22
canvas = document.querySelector('#canvas');23
overlay = document.querySelector('#overlay');24
memory = document.createElement('canvas');14
fit(canvas);15
fit(overlay);16
fit(memory);17
window.addEventListener('resize', function(event) {18
resize(canvas);19
resize(overlay);20
resize(memory);21
});22
}24
function fit(canvas) {25
canvas.width = window.innerWidth;26
canvas.height = window.innerHeight;27
}29
function get(canvas) {30
return canvas.getContext('2d');25
g = canvas.getContext('2d');26
o = overlay.getContext('2d');27
m = memory.getContext('2d');28
resize();29
window.addEventListener('resize', resize);30
}32
function get_canvas() {33
return canvas;34
}37
function resize(canvas) {38
let g = get(canvas);39
let image_data = g.getImageData(0, 0, canvas.width, canvas.height);40
fit(canvas);36
function resize() {37
width = window.innerWidth;38
height = window.innerHeight;39
backing_store_ratio = (40
g.webkitBackingStorePixelRatio ||41
g.mozBackingStorePixelRatio ||42
g.msBackingStorePixelRatio ||43
g.oBackingStorePixelRatio ||44
g.backingStorePixelRatio || 145
)46
ratio = DEVICE_PIXEL_RATIO / backing_store_ratio;47
let image_data;48
image_data = g.getImageData(0, 0, width * ratio, height * ratio);49
scale_canvas(canvas, g);50
g.putImageData(image_data, 0, 0);51
g.imageSmoothingEnabled = false;52
image_data = o.getImageData(0, 0, width * ratio, height * ratio);53
scale_canvas(overlay, o);54
o.putImageData(image_data, 0, 0);55
o.imageSmoothingEnabled = false;56
image_data = m.getImageData(0, 0, width * ratio, height * ratio);57
scale_canvas(memory, m);58
m.putImageData(image_data, 0, 0);59
m.imageSmoothingEnabled = false;60
}62
function scale_canvas(canvas, g) {63
if(DEVICE_PIXEL_RATIO !== backing_store_ratio) {64
canvas.width = width * ratio;65
canvas.height = height * ratio;66
canvas.style.width = width + 'px';67
canvas.style.height = height + 'px';68
}69
else {70
canvas.width = width;71
canvas.height = height;72
canvas.style.width = '';73
canvas.style.height = '';74
}75
g.scale(ratio, ratio);76
}78
function clear() {45
get(canvas).clearRect(0, 0, canvas.width, canvas.height);46
get(memory).clearRect(0, 0, memory.width, memory.height);79
g.clearRect(0, 0, width, height);80
m.clearRect(0, 0, width, height);81
}49
function on_press(event) {50
active = true;83
function on_press(event, state) {84
point_list.push({85
x: event.layerX,86
y: event.layerY87
});88
active = true;89
}91
function on_move(event, state) {92
if(active) {59
get(canvas).clearRect(0, 0, canvas.width, canvas.height);60
get(canvas).drawImage(memory, 0, 0);93
g.clearRect(0, 0, width, height);94
g.drawImage(memory, 0, 0, width, height);95
point_list.push({96
x: event.layerX,97
y: event.layerY
103
function on_release(event) {104
if(active) {71
if(event.type === 'pointerup') {105
if(event && event.type === 'pointerup') {106
active = false;107
}74
get(memory).clearRect(0, 0, memory.width, memory.height);75
get(memory).drawImage(canvas, 0, 0);108
m.clearRect(0, 0, width, height);109
m.drawImage(canvas, 0, 0, width, height);110
point_list = [];111
}112
}114
function draw_curve(state) {81
let g = get(canvas);115
g.lineJoin = 'round';116
g.lineCap = 'round';117
g.lineWidth = 2 * state.radius;85
g.strokeStyle = COLORS[state.color] + 'BB';86
if(point_list.length < 3) {87
return;88
}118
g.strokeStyle = COLORS[state.color] + '';119
if(point_list.length < 3) {120
g.fillStyle = COLORS[state.color] + '';121
g.beginPath();91
g.arc(point_list[0].x + 0.5, point_list[0].y + 0.5, g.lineWidth / 2, 0, Math.PI * 2, !0);122
g.arc(point_list[0].x, point_list[0].y, g.lineWidth / 2, 0, Math.PI * 2, !0);123
g.closePath();124
g.fill();125
return;126
}127
g.beginPath();97
g.moveTo(point_list[0].x + 0.5, point_list[0].y + 0.5);128
g.moveTo(point_list[0].x, point_list[0].y);129
let i;130
for(i = 1; i < point_list.length - 2; i++) {131
let dx = (point_list[i].x + point_list[i + 1].x);132
let dy = (point_list[i].y + point_list[i + 1].y);102
g.quadraticCurveTo(point_list[i].x + 0.5, point_list[i].y + 0.5, (dx / 2) + 0.5, (dy / 2) + 0.5);133
g.quadraticCurveTo(point_list[i].x, point_list[i].y, parseInt(dx / 2), parseInt(dy / 2));134
}104
g.quadraticCurveTo(point_list[i].x + 0.5, point_list[i].y + 0.5, point_list[i + 1].x + 0.5, point_list[i + 1].y + 0.5);135
g.quadraticCurveTo(point_list[i].x, point_list[i].y, point_list[i + 1].x, point_list[i + 1].y);136
g.stroke();137
}139
function draw_cursor(state) {140
o.clearRect(0, 0, window.innerWidth, window.innerHeight);141
if(state.point) {142
if(!active) {143
o.fillStyle = COLORS[state.color] + '';144
o.beginPath();145
o.arc(state.point.x, state.point.y, 2 * state.radius / 2, 0, Math.PI * 2, !0);146
o.closePath();147
o.fill();148
}149
o.strokeStyle = 'white';150
o.beginPath();151
o.arc(state.point.x, state.point.y, 2 * state.radius / 2, 0, Math.PI * 2, !0);152
o.closePath();153
o.stroke();154
}155
}157
export default {158
init,110
fit,111
get,159
get_canvas,160
resize,161
scale_canvas,162
clear,163
on_press,164
on_move,165
on_release,118
draw_curve166
draw_curve,167
draw_cursor168
};
111
*/112
}114
export default { init, get, on_connect, on_disconnect, on_pressed };114
export default {115
init,116
get,117
on_connect,118
on_disconnect,119
on_pressed120
};122
// !!! TODO !!!123
/*124
gamepad.init();125
// detect gamepad126
gamepad.on_connect(function(gamepad) {127
state.device_list.gamepad = true;128
show_notification('notification.input-device.gamepad.add');129
if(!state.device) {130
state.device = 'gamepad';131
state.device_fallback = 'gamepad';132
}133
update_device_list();134
});135
// gamepad removed136
gamepad.on_disconnect(function(gamepad) {137
state.device_list.gamepad = false;138
show_notification('notification.input-device.gamepad.remove');139
if(state.device === 'gamepad') {140
if(state.device !== state.device_fallback) {141
state.device = state.device_fallback;142
}143
else {144
state.device = null;145
}146
// point = { x: null, y: null };147
// last = { x: null, y: null };148
}149
update_device_list();150
});151
*/153
// !!! TODO !!!154
/*
63
}65
/**66
Returns the current locale.68
@function get_current69
@return {string} The current locale.70
*/71
function get_current() {72
return current_lang;73
}75
/**76
Returns the locale object by the given locale code.78
@function change
118
}119
}111
export default { init, load, parse, get, change };121
export default {122
init,123
load,124
parse,125
get_current,126
get,127
change128
};
1
const COLORS = {2
0: '#FFCDD2',3
1: '#E57373',4
2: '#F44336',5
3: '#D32F2F',6
4: '#B71C1C',7
5: '#F8BBD0',8
6: '#F06292',9
7: '#E91E63',10
8: '#C2185B',11
9: '#880E4F',12
10: '#E1BEE7',13
11: '#BA68C8',14
12: '#9C27B0',15
13: '#7B1FA2',16
14: '#4A148C',17
15: '#BBDEFB',18
16: '#64B5F6',19
17: '#2196F3',20
18: '#1976D2',21
19: '#0D47A1',22
20: '#B2EBF2',23
21: '#4DD0E1',24
22: '#00BCD4',25
23: '#0097A7',26
24: '#006064',27
25: '#B2DFDB',28
26: '#4DB6AC',29
27: '#009688',30
28: '#00796B',31
29: '#004D40',32
30: '#C8E6C9',33
31: '#81C784',34
32: '#4CAF50',35
33: '#388E3C',36
34: '#1B5E20',37
35: '#FFF9C4',38
36: '#FFF176',39
37: '#FFEB3B',40
38: '#FBC02D',41
39: '#F57F17',42
40: '#FFE0B2',43
41: '#FFB74D',44
42: '#FF9800',45
43: '#F57C00',46
44: '#E65100',47
45: '#D7CCC8',48
46: '#A1887F',49
47: '#795548',50
48: '#5D4037',51
49: '#3E2723',52
50: '#F5F5F5',53
51: '#E0E0E0',54
52: '#9E9E9E',55
53: '#616161',56
54: '#141414'57
};1
const COLORS = [2
'#FFCDD2',3
'#E57373',4
'#F44336',5
'#D32F2F',6
'#B71C1C',7
'#F8BBD0',8
'#F06292',9
'#E91E63',10
'#C2185B',11
'#880E4F',12
'#E1BEE7',13
'#BA68C8',14
'#9C27B0',15
'#7B1FA2',16
'#4A148C',17
'#BBDEFB',18
'#64B5F6',19
'#2196F3',20
'#1976D2',21
'#0D47A1',22
'#B2EBF2',23
'#4DD0E1',24
'#00BCD4',25
'#0097A7',26
'#006064',27
'#B2DFDB',28
'#4DB6AC',29
'#009688',30
'#00796B',31
'#004D40',32
'#C8E6C9',33
'#81C784',34
'#4CAF50',35
'#388E3C',36
'#1B5E20',37
'#FFF9C4',38
'#FFF176',39
'#FFEB3B',40
'#FBC02D',41
'#F57F17',42
'#FFE0B2',43
'#FFB74D',44
'#FF9800',45
'#F57C00',46
'#E65100',47
'#D7CCC8',48
'#A1887F',49
'#795548',50
'#5D4037',51
'#3E2723',52
'#F5F5F5',53
'#E0E0E0',54
'#9E9E9E',55
'#616161',56
'#141414'57
];59
export { COLORS };
4
// addons5
import canvas from './addon/canvas.js';6
import locale from './addon/locale.js';7
import gamepad from './addon/gamepad.js';7
import ripple from './addon/ripple.js';8
// import gamepad from './addon/gamepad.js';10
let node;11
let state = {12
color: 54,13
color_list: [54, 2, 17, 27, 37, 12],
20
touch: false,21
pen: false,22
gamepad: false22
}23
},24
timestamp: null,25
modal: null,26
tab: null27
};25
let node;27
// state variables28
let notification_code;29
let left_modal = false;30
let current_modal;31
let current_tab;33
// node elements34
let ad;35
let hotbar;36
let toolbar;37
let actionbar;38
let actions;39
let tools;40
let device_empty;41
let colors_modal;42
let capture_modal;43
let clear_modal;44
let scale_range;46
window.toggle_modal = toggle_modal;47
window.open_tab = open_tab;48
window.close_tab = close_tab;49
window.clear_screen = clear_screen;29
window.addEventListener('load', init);31
function init() {33
canvas.init();34
locale.init('en');35
locale.load('../asset/lang', ['en', 'de']);57
gamepad.init();36
ripple.init();59
// detect gamepad60
gamepad.on_connect(function(gamepad) {61
state.device_list.gamepad = true;62
show_notification('notification.input-device.gamepad.add');63
if(!state.device) {64
state.device = 'gamepad';65
state.device_fallback = 'gamepad';66
}67
update_device_list();68
});69
// gamepad removed70
gamepad.on_disconnect(function(gamepad) {71
state.device_list.gamepad = false;72
show_notification('notification.input-device.gamepad.remove');73
if(state.device === 'gamepad') {74
if(state.device !== state.device_fallback) {75
state.device = state.device_fallback;76
}77
else {78
state.device = null;79
}80
// point = { x: null, y: null };81
// last = { x: null, y: null };82
}83
update_device_list();84
});85
init_custom();38
node = query({39
modal_list: { query: '.modal', all: true },89
hotbar_color_list: { query: '.hotbar .color', all: true },40
tab_list: { query: '.tab', all: true },41
hotbar_list: { query: '.hotbar .color', all: true },42
modal_color_list: { query: '.colors-modal .color', all: true },91
device_list: { query: '.settings-modal .device-tab .item[data-event="change.device"]', all: true }43
language_list: { query: '.settings-modal .language-tab .item[data-event="change.language"]', all: true },44
device_list: { query: '.settings-modal .device-tab .item[data-event="change.device"]', all: true },45
modal_event_list: { query: '[data-event*=".modal"]', all: true },46
tab_event_list: { query: '[data-event*=".tab"]', all: true },47
tool_list: { query: '.tool', all: true },48
action_list: { query: '.action', all: true },49
notification: '.notification',50
scale_input: 'input.scale[type="range"]',51
clear: 'button.btn-apply[data-event="clear"]'52
});54
fill_hotbar_list();55
fill_modal_color_list();57
bind_events();58
}60
function bind_events() {61
document.addEventListener('dragstart', prevent);62
document.addEventListener('contextmenu', prevent);63
document.addEventListener('pointerdown', on_pointerdown);64
document.addEventListener('pointermove', on_pointermove);65
document.addEventListener('pointerup', on_pointerup);66
document.addEventListener('pointerout', on_pointerout);67
document.addEventListener('keydown', on_keydown);68
document.addEventListener('wheel', on_wheel);69
document.addEventListener('wheel', function(event) {70
if(event.ctrlKey) {71
prevent(event);72
}73
}, { passive: false });74
document.addEventListener('touchmove', function(event) {95
let { target } = event;96
if(target !== scale_range) {75
if(event.target !== node.scale_input) {76
event.preventDefault();77
}78
}, { passive: false });101
device_empty = document.querySelector('.settings-modal .device-tab .item.empty');102
ad = document.querySelector('.controls .ad');103
hotbar = document.querySelector('.controls .hotbar');104
toolbar = document.querySelector('.controls .toolbar');105
actionbar = document.querySelector('.controls .actionbar');106
actions = document.querySelectorAll('.actionbar .action');107
tools = document.querySelectorAll('.toolbar .tool');108
colors_modal = document.querySelector('.toolbar .tool[data-modal="colors"]');109
capture_modal = document.querySelector('.toolbar .tool[data-modal="capture"]');110
clear_modal = document.querySelector('.toolbar .tool[data-modal="clear"]');111
scale_range = document.querySelector('.scale-modal input[type="range"]');112
for(let i in node.hotbar_color_list) {113
if(Object.keys(state.color_list).length > i) {114
if(i == state.index) {115
node.hotbar_color_list[i].classList.add('active');80
for(let item of node.language_list) {81
item.addEventListener('click', function(event) {82
let code = item.dataset.code;83
locale.change(code);84
update_language_list();85
});86
}87
for(let item of node.device_list) {88
item.addEventListener('click', function(event) {89
let code = item.dataset.code;90
if(state.device_list[code]) {91
state.device = code;92
update_device_list();93
}117
node.hotbar_color_list[i].style.background = COLORS[state.color_list[i]];118
node.hotbar_color_list[i].addEventListener('pointerdown', function(event) {119
state.color = state.color_list[i];120
for(let j in node.hotbar_color_list) {121
if(Object.keys(state.color_list).length > j) {122
if(j == i) {123
state.index = j;94
});95
}96
for(let item of node.modal_event_list) {97
item.addEventListener('click', function(event) {98
let code = item.dataset.code;99
let match = /^(toggle|open|close).modal$/.exec(item.dataset.event);100
if(match) {101
switch(match[1]) {102
case 'toggle':103
if(code) {104
state.modal = state.modal !== code ? code : null;105
update_modal_list();106
}125
node.hotbar_color_list[j].classList[j == i ? 'add' : 'remove']('active');126
}107
break;108
case 'open':109
if(code && state.modal !== code) {110
state.modal = code;111
update_modal_list();112
}113
break;114
case 'close':115
if(state.modal !== null) {116
state.modal = null;117
update_modal_list();118
}119
break;120
default:121
break;122
}128
});129
}123
}124
});125
}131
for(let i in node.modal_color_list) {132
if(Object.keys(COLORS).length > i) {133
node.modal_color_list[i].style.background = COLORS[i];134
node.modal_color_list[i].addEventListener('pointerdown', function(event) {135
state.color = i;136
});137
}126
for(let item of node.tab_event_list) {127
item.addEventListener('click', function(event) {128
let code = item.dataset.code;129
let match = /^(open|close).tab/.exec(item.dataset.event);130
if(match) {131
switch(match[1]) {132
case 'open':133
if(code && state.tab !== code) {134
state.tab = code;135
update_tab_list();136
}137
break;138
case 'close':139
if(state.tab !== null) {140
state.tab = null;141
update_tab_list();142
}143
break;144
default:145
break;146
}147
}148
});149
}139
document.addEventListener('dragstart', prevent);140
document.addEventListener('contextmenu', prevent);141
scale_range.addEventListener('input', function(event) {142
state.radius = parseInt(scale_range.value);143
left_modal = false;144
// point.x = parseInt(window.innerWidth / 2);145
// point.y = parseInt(window.innerHeight / 2);150
node.scale_input.addEventListener('input', function(event) {151
state.radius = parseInt(node.scale_input.value);152
state.point = {153
x: parseInt(window.innerWidth / 2),154
y: parseInt(window.innerHeight / 2)155
};156
canvas.draw_cursor(state);157
});147
document.addEventListener('wheel', function(event) {148
if(state.device === 'mouse') {149
let y = event.deltaY < 0 ? 1 : -1;150
if(state.radius + y > 2 - 1 && state.radius + y < 50 + 1) {151
state.radius += y;152
scale_range.value = state.radius;153
}154
}158
node.clear.addEventListener('click', function(event) {159
canvas.clear();160
show_notification('notification.clear');161
state.modal = null;162
update_modal_list();163
});156
document.addEventListener('wheel', function(event) {157
if(state.device === 'mouse') {158
if(event.ctrlKey) {159
event.preventDefault();160
return;161
}162
}163
}, { passive: false });164
}165
document.addEventListener('pointerdown', function(event) {166
if(state.device !== 'gamepad') {167
if(state.device === event.pointerType) {168
if(event.target === canvas.get_canvas()) {169
canvas.on_press(event);166
function update_language_list() {167
let lang = locale.get_current();168
for(let item of node.language_list) {169
let code = item.dataset.code;170
item.classList[code === lang ? 'add' : 'remove']('active');171
}172
}171
ad.style.pointerEvents = 'none';172
hotbar.style.pointerEvents = 'none';173
toolbar.style.pointerEvents = 'none';174
actionbar.style.pointerEvents = 'none';175
for(let modal of node.modal_list) {176
modal.style.pointerEvents = 'none';177
}178
}179
}180
}181
});182
document.addEventListener('pointermove', function(event) {183
if(state.device !== 'gamepad') {184
if(state.device === event.pointerType) {185
if(event.target === canvas.get_canvas()) {186
canvas.on_move(event, state);187
}188
}189
}190
});191
document.addEventListener('pointerup', function(event) {192
if(state.device !== 'gamepad') {193
if(state.device === event.pointerType) {194
canvas.on_release(event);174
function update_device_list() {175
canvas.get_canvas().style.cursor = state.device === 'mouse' ? 'none' : '';176
for(let item of node.device_list) {177
let code = item.dataset.code;178
item.classList[code === state.device ? 'add' : 'remove']('active');179
item.classList[state.device_list[code] ? 'remove' : 'add']('inactive');180
}181
}196
ad.style.pointerEvents = '';197
hotbar.style.pointerEvents = '';198
toolbar.style.pointerEvents = '';199
actionbar.style.pointerEvents = '';200
for(let modal of node.modal_list) {201
modal.style.pointerEvents = '';202
}203
}183
function update_hotbar() {184
canvas.on_release(event);185
for(let item of node.hotbar_list) {186
item.classList[node.hotbar_list[state.index] === item ? 'add' : 'remove']('active');187
}188
}190
function update_focus(bool) {191
for(let item of node.hotbar_list) {192
item.style.pointerEvents = bool ? '' : 'none';193
}194
for(let item of node.tool_list) {195
item.style.pointerEvents = bool ? '' : 'none';196
}197
for(let item of node.action_list) {198
item.style.pointerEvents = bool ? '' : 'none';199
}200
}202
function update_modal_list() {203
for(let item of node.modal_list) {204
item.classList.add('hidden');205
}206
for(let item of node.tool_list) {207
item.classList.remove('active');208
}209
for(let item of node.action_list) {210
item.classList.remove('active');211
}212
state.tab = null;213
update_tab_list();214
if(state.modal) {215
let modal = document.querySelector(`.modal.${state.modal}-modal`);216
let button = document.querySelector(`[data-event*=".modal"][data-code="${state.modal}"]`);217
if(modal) {218
modal.classList.remove('hidden');219
modal.animate([220
{ opacity: 0, marginTop: '-6px' },221
{ opacity: 1, marginTop: '0' }222
], {223
duration: 100,224
fill: 'both'225
});226
}205
});206
document.addEventListener('pointerout', function(event) {207
if(state.device !== 'gamepad') {208
if(state.device === event.pointerType) {209
canvas.on_release(event);210
}227
if(button) {228
button.classList.add('active');229
}212
});230
}231
}214
document.addEventListener('keydown', function(event) {215
if(state.device !== 'gamepad') {216
let lock = event.getModifierState("CapsLock");217
if(!event.ctrlKey && !event.shiftKey && !event.altKey) {218
if(!lock) {219
if(event.code.startsWith('Digit')) {220
let digit = parseInt(event.code.substr(5)) - 1;221
if(digit >= 0 && digit < state.color_list.length) {222
state.color = state.color_list[digit];223
state.index = digit;224
for(let i in node.hotbar_color_list) {225
if(state.color_list.length > i) {226
node.hotbar_color_list[i].classList[i == state.index ? 'add' : 'remove']('active');227
}228
}229
}230
}231
}232
}233
function update_tab_list() {234
for(let item of node.modal_list) {235
let main = item.querySelector('.main');236
if(main) {237
main.classList.remove('hidden');238
main.style.marginLeft = '0';239
}234
if(event.code === 'Escape') {235
if(current_tab) {236
close_tab(current_tab);237
}238
else if(current_modal) {239
toggle_modal(current_modal);240
}240
}241
for(let item of node.tab_list) {242
item.classList.add('hidden');243
}244
if(state.modal && state.tab) {245
let modal = document.querySelector(`.modal.${state.modal}-modal`);246
let tab = document.querySelector(`.${state.tab}-tab`);247
let main = modal.querySelector('.main');248
if(modal && tab && main) {249
tab.classList.remove('hidden');250
main.style.marginLeft = '-100%';251
main.classList.add('hidden');252
}242
});243
// point = { x: null, y: null };244
// last = { x: null, y: null };245
// start = { x: null, y: null };253
}254
}248
/*249
function render() {250
if(state.radius < 2) {251
state.radius = 2;252
}253
o.clearRect(0, 0, window.innerWidth, window.innerHeight);254
if(point.x !== null && point.y !== null) {255
let touch_device = (state.device === 'touch' || state.device === 'pen');256
if(touch_device) {257
if(!left_modal) {258
o.fillStyle = 'white';259
o.beginPath();260
o.arc(point.x, point.y, parseInt(state.radius) + 2, 2 * Math.PI, 0);261
o.fill();262
o.fillStyle = COLOR[state.index];263
o.beginPath();264
o.arc(point.x, point.y, parseInt(state.radius), 2 * Math.PI, 0);265
o.fill();266
}256
function on_pointerdown(event) {257
// detect touch258
if(!state.device_list.touch && event.pointerType === 'touch') {259
state.device_list.touch = true;260
if(state.device) {261
show_notification('notification.input-device.touch.add');262
}263
else {269
o.fillStyle = 'white';270
o.beginPath();271
o.arc(point.x, point.y, parseInt(state.radius) + 2, 2 * Math.PI, 0);272
o.fill();273
o.fillStyle = COLOR[state.index];274
o.beginPath();275
o.arc(point.x, point.y, parseInt(state.radius), 2 * Math.PI, 0);276
o.fill();264
state.device = 'touch';265
state.device_fallback = 'touch';266
}267
update_device_list();268
}279
if(!left_modal) {280
if(erase && !draw) {281
o.beginPath();282
o.lineWidth = 2;283
o.strokeStyle = 'white';284
o.moveTo(point.x, point.y - parseInt(state.radius) * 0.5);285
o.lineTo(point.x, point.y + parseInt(state.radius) * 0.5);286
o.moveTo(point.x - parseInt(state.radius) * 0.5, point.y);287
o.lineTo(point.x + parseInt(state.radius) * 0.5, point.y);288
o.stroke();269
// detect pen270
if(!state.device_list.pen && event.pointerType === 'pen') {271
state.device_list.pen = true;272
show_notification('notification.input-device.pencil.add');273
if(!state.device) {274
state.device = 'pen';275
state.device_fallback = 'pen';276
}277
update_device_list();278
}291
if(lock_x || lock_y) {292
o.beginPath();293
o.lineWidth = 2;294
o.strokeStyle = 'white';295
if(lock_x) {296
o.moveTo(point.x, point.y - parseInt(state.radius));297
o.lineTo(point.x, point.y + parseInt(state.radius));279
// drawing280
if(state.device === event.pointerType) {281
if(event.target === canvas.get_canvas()) {282
update_focus(false);283
canvas.on_press(event, state);284
state.point = {285
x: event.layerX,286
y: event.layerY287
};288
canvas.draw_cursor(state);289
}299
if(lock_y) {300
o.moveTo(point.x - parseInt(state.radius), point.y);301
o.lineTo(point.x + parseInt(state.radius), point.y);302
}303
o.stroke();290
}291
}306
*/308
function init_custom() {309
// language310
let language_elements = document.querySelectorAll('[data-event="change.language"]');311
for(let item of language_elements) {312
item.addEventListener('click', function(event) {313
let code = item.dataset.code;314
locale.change(code);315
for(let sub_item of language_elements) {316
sub_item.classList[item === sub_item ? 'add' : 'remove']('active');317
}318
});319
}320
document.addEventListener('pointerdown', function(event) {321
// detect touch322
if(!state.device_list.touch && event.pointerType === 'touch') {323
state.device_list.touch = true;324
if(state.device) {325
show_notification('notification.input-device.touch.add');326
}327
else {328
state.device = 'touch';329
state.device_fallback = 'touch';330
}331
update_device_list();293
function on_pointermove(event) {294
// detect mouse295
if(!state.device_list.mouse && event.pointerType === 'mouse') {296
state.device_list.mouse = true;297
if(state.device) {298
show_notification('notification.input-device.mouse.add');299
}333
// detect pen334
if(!state.device_list.pen && event.pointerType === 'pen') {335
state.device_list.pen = true;336
show_notification('notification.input-device.pencil.add');337
if(!state.device) {338
state.device = 'pen';339
state.device_fallback = 'pen';340
}341
update_device_list();300
else {301
state.device = 'mouse';302
state.device_fallback = 'mouse';303
}343
});344
document.addEventListener('pointermove', function(event) {345
// detect mouse346
if(!state.device_list.mouse && event.pointerType === 'mouse') {347
state.device_list.mouse = true;348
if(state.device) {349
show_notification('notification.input-device.mouse.add');350
}351
else {352
state.device = 'mouse';353
state.device_fallback = 'mouse';354
}355
update_device_list();304
update_device_list();305
}306
// drawing307
if(state.device === event.pointerType) {308
if(event.target === canvas.get_canvas()) {309
canvas.on_move(event, state);310
state.point = {311
x: event.layerX,312
y: event.layerY313
};314
canvas.draw_cursor(state);315
}357
});358
// device359
let device_elements = document.querySelectorAll('[data-event="change.device"]');360
for(let item of device_elements) {361
item.addEventListener('click', function(event) {362
let code = item.dataset.code;363
if(state.device_list[code]) {364
state.device = code;365
if(state.device !== 'gamepad') {366
// point = { x: null, y: null };367
// last = { x: null, y: null };368
}369
for(let sub_item of device_elements) {370
sub_item.classList[item === sub_item ? 'add' : 'remove']('active');371
}372
update_device_list();373
}374
});316
}317
}378
function update_device_list() {379
for(let item of node.device_list) {380
let code = item.dataset.code;381
item.classList[code === state.device ? 'add' : 'remove']('active');382
item.classList[state.device_list[code] ? 'remove' : 'add']('inactive');319
function on_pointerup(event) {320
if(state.device === event.pointerType) {321
canvas.on_release(event);322
canvas.draw_cursor(state);323
update_focus(true);324
}325
}386
function toggle_modal(element) {387
let code = element.dataset.modal;388
let modal = document.querySelector(`.${code}-modal`);389
if(modal) {390
let open = modal.classList.contains('hidden');391
if(open) {392
current_modal = element;393
for(let item of actions) {394
if(item !== element) {395
item.classList.remove('active');396
}397
}398
for(let item of tools) {399
if(item !== element) {400
item.classList.remove('active');401
}402
}403
for(let item of node.modal_list) {404
if(item !== modal) {405
item.classList.add('hidden');406
}407
let main = item.querySelector('.main');408
if(main) {409
main.classList.remove('hidden');410
main.style.marginLeft = '0';411
}412
let tab_list = item.querySelector('.tab-list');413
if(tab_list) {414
let tabs = tab_list.querySelectorAll('.tab');415
for(let tab of tabs) {416
tab.classList.add('hidden');327
function on_pointerout(event) {328
if(state.device === event.pointerType) {329
canvas.on_release(event);330
state.point = null;331
canvas.draw_cursor(state);332
}333
}335
function on_keydown(event) {336
let lock = event.getModifierState("CapsLock");337
if(!event.ctrlKey && !event.shiftKey && !event.altKey) {338
if(!lock) {339
if(event.code.startsWith('Digit')) {340
let i = parseInt(event.code.substr(5)) - 1;341
if(state.index !== i) {342
if(i >= 0 && i < state.color_list.length) {343
state.color = state.color_list[i];344
state.index = i;345
canvas.draw_cursor(state);346
update_hotbar();347
}348
}349
}420
if(code === 'colors') {421
if(state.device === 'gamepad') {422
node.modal_color_list[0].classList.add('focus');423
}424
}350
}426
else {427
current_modal = null;351
}352
if(event.code === 'Escape') {353
if(state.tab) {354
state.tab = null;355
update_tab_list();356
return;357
}358
if(state.modal) {359
state.modal = null;360
update_modal_list();361
return;362
}363
}364
}366
function on_wheel(event) {367
if(state.device === 'mouse') {368
let y = event.deltaY < 0 ? 1 : -1;369
if(state.radius + y > 2 - 1 && state.radius + y < 50 + 1) {370
state.radius += y;371
node.scale_input.value = state.radius;372
canvas.draw_cursor(state);373
}429
element.classList[open ? 'add' : 'remove']('active');430
modal.classList[open ? 'remove' : 'add']('hidden');431
modal.animate([432
{ opacity: 0, marginTop: '-6px' },433
{ opacity: 1, marginTop: '0' }434
], {435
duration: 100,436
fill: 'both'437
});374
}375
}441
function open_tab(element) {442
let code = element.dataset.tab;443
let main = element.parentNode.parentNode444
let tab = document.querySelector(`.${code}-tab`);445
if(tab) {446
main.style.marginLeft = '-100%';447
current_tab = tab.querySelector('.back');448
tab.classList.remove('hidden');449
main.classList.add('hidden');377
function fill_hotbar_list() {378
for(let [ i, item ] of Object.entries(node.hotbar_list)) {379
if(state.color_list.length > i) {380
item.style.background = COLORS[state.color_list[i]];381
item.addEventListener('pointerdown', function(event) {382
state.color = state.color_list[i];383
state.index = i;384
canvas.draw_cursor(state);385
update_hotbar();386
});387
if(state.index == i) {388
item.classList.add('active');389
}390
}391
}392
}453
function close_tab(element) {454
let modal = element.parentNode.parentNode.parentNode.parentNode;455
let main = modal.querySelector('.main');456
let tab_list = modal.querySelector('.tab-list');457
let tabs = tab_list.querySelectorAll('.tab');458
for(let tab of tabs) {459
tab.classList.add('hidden');394
function fill_modal_color_list() {395
for(let [ i, item ] of Object.entries(node.modal_color_list)) {396
if(COLORS.length > i) {397
item.style.background = COLORS[i];398
item.addEventListener('pointerdown', function(event) {399
state.color = i;400
state.modal = null;401
update_modal_list();402
canvas.draw_cursor(state);403
});404
}405
}461
main.classList.remove('hidden');462
main.style.marginLeft = '0';463
current_tab = null;406
}408
function show_notification(message) {409
let code = uuid();468
notification_code = code;469
let element = document.querySelector('.notification');470
let content = element.querySelector('.content');410
state.timestamp = code;411
let content = node.notification.querySelector('.content');412
content.textContent = locale.get()[message];472
element.animate([413
node.notification.animate([414
{ opacity: 0 },474
{ opacity: 1}415
{ opacity: 1 }416
], {417
duration: 200,418
fill: 'both'419
});420
setTimeout(function() {480
if(notification_code === code) {481
element.animate([421
if(state.timestamp === code) {422
node.notification.animate([423
{ opacity: 1 },483
{ opacity: 0}424
{ opacity: 0 }425
], {426
duration: 200,427
fill: 'both'
429
}430
}, 2000);431
}492
function clear_screen() {493
canvas.clear();494
show_notification('notification.clear');495
toggle_modal(clear_modal);496
}
72
event.preventDefault();73
}75
export { uuid, html, query, prevent };75
export {76
uuid,77
html,78
query,79
prevent80
};
1
* {2
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);2
-webkit-tap-highlight-color: transparent;3
}5
html,
32
color: white !important;34
&.prime {35
background: #0372EF;35
background: @brand-blue;36
}38
&.beta {39
background: #388E3C;39
background: @brand-green;40
}41
}
55
display: inline-block;56
padding: 10px 24px;57
border-radius: 999px;58
background: #24292E;58
background: @brand-black;59
color: white;60
opacity: 0.95;61
user-select: none;
63
}64
}66
.ad {67
position: fixed;68
width: 400px;69
height: 150px;70
border-radius: 4px;71
background: #EEE;72
bottom: 40px;73
right: 40px;74
pointer-events: all;75
}66
.hotbar {67
display: flex;68
position: fixed;69
left: calc(50% - 216px);70
bottom: 30px;82
pointer-events: all;71
z-index: -1;73
.color {
79
cursor: pointer;80
transition: transform 0.2s;81
transform: scale(0.9);82
pointer-events: all;84
&:not(.active):hover {85
transform: scale(1);
120
height: 20px;121
width: 20px;122
margin-top: -0px;134
background: #9E9E9E;123
background: @brand-grey-3;124
border-radius: 10px;125
cursor: pointer;127
&:hover {139
background: #757575;128
background: @brand-grey-2;129
}130
}131
}
142
.text-clear {143
font-size: 20px;144
width: 380px;156
height: px;145
text-align: center;146
align-items: center;147
}
155
height: 50px;156
border: none;157
border-radius: 3px;170
background-color: #F5F5F5;158
background-color: @brand-grey-6;159
font-size: 17px;161
&:hover {174
background-color: #E0E0E0;162
background-color: @brand-grey-4;163
}164
}
169
border: none;170
border-radius: 3px;171
border-color: grey;184
background-color: #F5F5F5;172
background-color: @brand-grey-6;173
margin-left: 10px;174
font-size: 17px;176
&:hover {189
background-color: #E0E0E0;177
background-color: @brand-grey-4;178
}179
}180
}
199
.preview {200
height: 250px;213
background: #F5F5F5;201
background: @brand-grey-6;202
border: 1px solid #f1f1f1;203
border-radius: 3px;204
margin-top: 20px;
227
height: 50px;228
border: none;229
border-radius: 3px;242
background-color: #F5F5F5;230
background-color: @brand-grey-6;231
font-size: 17px;232
margin-left: 20px;234
&:hover {247
background-color: #E0E0E0;235
background-color: @brand-grey-4;236
}237
}
242
border: none;243
border-radius: 3px;244
border-color: grey;257
background-color: #F5F5F5;245
background-color: @brand-grey-6;246
margin-left: 20px;247
font-size: 17px;249
&:hover {262
background-color: #E0E0E0;250
background-color: @brand-grey-4;251
}252
}253
}
267
.toolbar {268
display: flex;269
position: fixed;282
pointer-events: all;271
.action,272
.tool {
276
margin-left: 8px;277
border-radius: 22px;278
cursor: pointer;279
pointer-events: all;281
&:hover {294
background: rgba(#FAFAFA, 0.95);282
background: rgba(@brand-grey-7, 0.95);284
&.ripple {286
&:not(.active).ripple-active {299
background: lighten(rgba(#FAFAFA, 0.95), -2%);287
background: lighten(rgba(@brand-grey-7, 0.95), -2%);288
}290
&.active.ripple-active {
298
}300
i.ico {313
color: #424242;301
color: @brand-grey-0;302
}303
}304
}
372
width: 250px;373
position: fixed;374
background: white;387
border: 1px solid #F1F1F1;375
border: 1px solid @brand-grey-5;376
border-radius: 4px;377
padding: 6px 0;378
pointer-events: all;
408
cursor: pointer;410
i.ico {423
color: #424242;411
color: @brand-grey-0;412
}414
&:hover {427
background: #FAFAFA;415
background: @brand-grey-7;416
}418
&.ripple {420
&.ripple-active {433
background: lighten(#FAFAFA, -2%);421
background: lighten(@brand-grey-7, -2%);422
}423
}424
}
432
display: flex;433
align-items: center;434
font-weight: 500;447
color: #616161;435
color: @brand-grey-1;436
user-select: none;437
pointer-events: none;438
}
441
display: block;442
margin-top: 3px;443
font-size: 12px;456
color: #9E9E9E;444
color: @brand-grey-3;445
user-select: none;446
pointer-events: none;447
}
454
margin: 6px 0;455
width: 100%;456
height: 1px;469
background: #F1F1F1;457
background: @brand-grey-5;458
}460
li.caption {
463
list-style: none;465
p {478
color: #9E9E9E;466
color: @brand-grey-3;467
user-select: none;468
pointer-events: none;469
}
480
p {481
display: block;482
width: 100%;495
color: #9E9E9E;483
color: @brand-grey-3;484
text-align: center;485
user-select: none;486
pointer-events: none;
490
&:not(.active):not(.inactive) {492
&:hover {505
background: #FAFAFA;493
background: @brand-grey-7;494
}496
&.ripple {498
&.ripple-active {511
background: lighten(#FAFAFA, -2%);499
background: lighten(@brand-grey-7, -2%);500
}501
}502
}504
i.ico {517
color: #424242;505
color: @brand-grey-0;506
user-select: none;507
pointer-events: none;508
}
515
font-weight: 600;516
width: 24px;517
height: 24px;530
color: #424242;518
color: @brand-grey-0;519
user-select: none;520
pointer-events: none;521
}
530
display: flex;531
align-items: center;532
font-weight: 500;545
color: #616161;533
color: @brand-grey-1;534
user-select: none;535
pointer-events: none;536
}
539
display: block;540
margin-top: 3px;541
font-size: 12px;554
color: #9E9E9E;542
color: @brand-grey-3;543
user-select: none;544
pointer-events: none;545
white-space: nowrap;
562
&.inactive {564
i.ico {577
color: #9E9E9E;565
color: @brand-grey-3;566
}568
.info {570
p {583
color: #9E9E9E;571
color: @brand-grey-3;572
}573
}574
}575
}576
}577
}591
.tooltip {592
position: relative;593
display: flex;594
justify-content: center;595
align-items: center;597
&:hover {599
&::before {600
opacity: 0.95;601
transition-delay: 0.6s;602
}604
&::after {605
opacity: 0.95;606
transition-delay: 0.6s;607
}608
}610
&::after {611
display: flex;612
opacity: 0;613
content: attr(data-title);614
justify-content: center;615
align-items: center;616
position: absolute;617
background: #24292E;618
color: white;619
min-height: 24px;620
padding: 0 12px;621
border-radius: 999px;622
font-size: 12px;623
top: auto;624
bottom: -70%;625
white-space: nowrap;626
z-index: 9999;627
pointer-events: none;628
}630
&.up {632
&::before {633
top: ~'calc(-90% + 26px)';634
bottom: auto;635
border-left: 6px solid transparent;636
border-right: 6px solid transparent;637
border-top: 6px solid #24292E;638
border-bottom: none;639
}641
&::after {642
top: -60%;643
bottom: auto;644
}645
}647
&.down {649
&::before {650
top: auto;651
bottom: ~'calc(-90% + 26px)';652
border-left: 6px solid transparent;653
border-right: 6px solid transparent;654
border-top: none;655
border-bottom: 6px solid #24292E;656
}658
&::after {659
top: auto;660
bottom: -60%;661
}662
}663
}
1
@import (less) 'variable.less';2
@import (less) 'theme.less';4
@import (less) 'index.less';5
@import (less) 'tooltip.less';
1
@brand-blue: #0372EF;2
@brand-green: #388E3C;3
@brand-black: #24292E;5
@brand-grey-0: #424242;6
@brand-grey-1: #616161;7
@brand-grey-2: #757575;8
@brand-grey-3: #9E9E9E;9
@brand-grey-4: #E0E0E0;10
@brand-grey-5: #F1F1F1;11
@brand-grey-6: #F5F5F5;12
@brand-grey-7: #FAFAFA;
1
.tooltip {2
position: relative;3
display: flex;4
justify-content: center;5
align-items: center;7
&:hover {9
&::before {10
opacity: 0.95;11
transition-delay: 0.6s;12
}14
&::after {15
opacity: 0.95;16
transition-delay: 0.6s;17
}18
}20
&::after {21
display: flex;22
opacity: 0;23
content: attr(data-title);24
justify-content: center;25
align-items: center;26
position: absolute;27
background: @brand-black;28
color: white;29
min-height: 24px;30
padding: 0 12px;31
border-radius: 999px;32
font-size: 12px;33
top: auto;34
bottom: -70%;35
white-space: nowrap;36
z-index: 9999;37
pointer-events: none;38
}40
&.up {42
&::before {43
top: ~'calc(-90% + 26px)';44
bottom: auto;45
border-left: 6px solid transparent;46
border-right: 6px solid transparent;47
border-top: 6px solid @brand-black;48
border-bottom: none;49
}51
&::after {52
top: -60%;53
bottom: auto;54
}55
}57
&.down {59
&::before {60
top: auto;61
bottom: ~'calc(-90% + 26px)';62
border-left: 6px solid transparent;63
border-right: 6px solid transparent;64
border-top: none;65
border-bottom: 6px solid @brand-black;66
}68
&::after {69
top: auto;70
bottom: -60%;71
}72
}73
}
4
@screen-md: 992px;5
@screen-lg: 1200px;7
@color-success: #28A745;8
@color-danger: #DC3545;9
@color-info: #007BFF;7
* {8
margin: 0;9
padding: 0;