Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function canvasViewPortal ( ){
- var [ px, py, pz ] = cursorState ( layers.gui );
- drawRectangle(gutterW, gutterH, viewConstraints.viewSpanX * tileW, viewConstraints.viewSpanY * tileH, 'black', 'black');
- let buffer = [];
- for(let y = viewConstraints.viewMinY; y <= viewConstraints.viewMaxY; y++){
- for(let x = viewConstraints.viewMinX; x <= viewConstraints.viewMaxX; x++){
- buffer = [];
- px = cx + x;
- py = cy + y;
- if(oobMap([px,py]) !== true){
- buffer.push(special.stonwall);
- }
- if(oobMap([px,py]) === true){
- for(let z = 0; z <= pz; z++){
- buffer.push(`${sections(full_map[px][py][z])[0]}____`);
- }
- if( ( x === 0 ) && ( y === 0 ) ){
- buffer.push(special.sel1dash);
- }
- }
- // logFeats(hover);
- if( ( x === viewCursor.hover.x ) && ( y === viewCursor.hover.y ) ){
- buffer.push(special.sel2dash);
- }
- buffer.push(special.sel2dots);
- drawImageStack(buffer,gutterW+(x - viewConstraints.viewMinX)*tileW,gutterH+(y - viewConstraints.viewMinY)*tileH,tileW,tileH);
- }
- }
- return true;
- }
- function canvasScrollBars ( ) {
- var [ px, py, pz ] = cursorState ( layers.gui );
- var gutterW = 0;
- var gutterH = 0;
- let scrollX1 = ( cx - viewSpanX / 2 ) / full_map.length;
- let scrollX2 = ( cx + viewSpanX / 2 ) / full_map.length;
- let scrollY1 = ( cy - viewSpanY / 2 ) / full_map[0].length;
- let scrollY2 = ( cy + viewSpanY / 2 ) / full_map[0].length;
- scrollX1 = viewSpanX * tileW * scrollX1;
- scrollX2 = viewSpanX * tileW * scrollX2;
- scrollY1 = viewSpanY * tileH * scrollY1;
- scrollY2 = viewSpanY * tileH * scrollY2;
- if( scrollX1 < 0 ){
- scrollX1 = 0;
- }
- if( scrollY1 < 0 ){
- scrollY1 = 0;
- }
- if( scrollX1 > viewSpanX * tileW ){
- scrollX1 = viewSpanX * tileW;
- }
- if( scrollY1 > viewSpanY * tileH ){
- scrollY1 = viewSpanY * tileH;
- }
- if( scrollX2 < 0 ){
- scrollX2 = 0;
- }
- if( scrollY2 < 0 ){
- scrollY2 = 0;
- }
- if( scrollX2 > viewSpanX * tileW ){
- scrollX2 = viewSpanX * tileW;
- }
- if( scrollY2 > viewSpanY * tileH ){
- scrollY2 = viewSpanY * tileH;
- }
- scrollW = scrollX2 - scrollX1;
- scrollH = scrollY2 - scrollY1;
- // left backbar
- drawRectangle(
- gutterW,
- gutterH,
- 8,
- viewSpanY*tileH,
- 'rgba(0,0,0,0.0)',
- 'red'
- );
- // top backbar
- drawRectangle(
- gutterW,
- gutterH,
- viewSpanX*tileW,
- 8,
- 'rgba(0,0,0,0.0)',
- 'red'
- );
- gutterW = 0;
- gutterH = 0;
- // right backbar
- drawRectangle(
- gutterW+viewSpanX*tileW,
- gutterH,
- 8,
- viewSpanY*tileH,
- 'rgba(0,0,0,0.0)',
- 'red'
- );
- // bottom backbar
- drawRectangle(
- gutterW,
- gutterH+viewSpanY*tileH,
- viewSpanX*tileW,
- 8,
- 'rgba(0,0,0,0.0)',
- 'red'
- );
- // right scrollbar
- drawRectangle(
- gutterW*2+viewSpanX*tileW,
- gutterH*2+scrollY1,
- 8,
- scrollH,
- 'black',
- '#00ff00'
- );
- // bottom scrollbar
- drawRectangle(
- gutterW*2+scrollX1,
- gutterH*2+viewSpanY*tileH,
- scrollW,
- 8,
- 'black',
- '#00ff00'
- );
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement