Commit 25ec7b5b by Daniel Lee

scrollbar: use native scroll for page

parent 63dab4ff
import coreModule from 'app/core/core_module';
import appEvents from 'app/core/app_events';
export function pageScrollbar() {
return {
restrict: 'A',
link: function(scope, elem, attrs) {
let lastPos = 0;
appEvents.on(
'dash-scroll',
evt => {
if (evt.restore) {
elem[0].scrollTop = lastPos;
return;
}
lastPos = elem[0].scrollTop;
if (evt.animate) {
elem.animate({ scrollTop: evt.pos }, 500);
} else {
elem[0].scrollTop = evt.pos;
}
},
scope
);
scope.$on('$routeChangeSuccess', () => {
lastPos = 0;
elem[0].scrollTop = 0;
});
},
};
}
coreModule.directive('pageScrollbar', pageScrollbar);
......@@ -47,6 +47,7 @@ import { NavModelSrv, NavModel } from './nav_model_srv';
import { userPicker } from './components/user_picker';
import { teamPicker } from './components/team_picker';
import { geminiScrollbar } from './components/scroll/scroll';
import { pageScrollbar } from './components/scroll/page_scroll';
import { gfPageDirective } from './components/gf_page';
import { orgSwitcher } from './components/org_switcher';
import { profiler } from './profiler';
......@@ -85,6 +86,7 @@ export {
userPicker,
teamPicker,
geminiScrollbar,
pageScrollbar,
gfPageDirective,
orgSwitcher,
manageDashboardsDirective,
......
<div dash-class ng-if="ctrl.dashboard">
<dashnav dashboard="ctrl.dashboard"></dashnav>
<div class="scroll-canvas scroll-canvas--dashboard">
<div grafana-scrollbar>
<div class="scroll-canvas scroll-canvas--dashboard" page-scrollbar>
<div>
<dashboard-settings dashboard="ctrl.dashboard"
ng-if="ctrl.dashboardViewState.state.editview"
class="dashboard-settings">
......
......@@ -74,6 +74,7 @@
.graph-legend-scroll {
position: relative;
overflow: auto !important;
}
.graph-legend-icon {
......
......@@ -106,22 +106,16 @@
opacity: 0.9;
}
// Srollbars
// Scrollbars
//
// ::-webkit-scrollbar {
// width: 8px;
// height: 8px;
// }
// ::-webkit-scrollbar:hover {
// height: 8px;
// }
::-webkit-scrollbar {
// Hide system scrollbar (Mac OS X)
width: 0;
height: 0;
width: 8px;
height: 8px;
}
::-webkit-scrollbar:hover {
height: 8px;
}
::-webkit-scrollbar-button:start:decrement,
......
......@@ -40,8 +40,7 @@
</div>
<div class="main-view">
<!-- Not sure do we really need grafana-scrollbar here? -->
<div class="scroll-canvas" grafana-scrollbar>
<div class="scroll-canvas">
<div ng-view></div>
<footer class="footer">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment