Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
meshviewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
infrastruktur
meshviewer
Commits
8c497817
Commit
8c497817
authored
Feb 8, 2017
by
Xaver Maierhofer
Committed by
Xaver Maierhofer
Feb 9, 2017
Browse files
Options
Downloads
Patches
Plain Diff
[TASK] Avoid render blocking onload
parent
7cbc4e75
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/map/labelslayer.js
+5
-4
5 additions, 4 deletions
lib/map/labelslayer.js
lib/sidebar.js
+10
-2
10 additions, 2 deletions
lib/sidebar.js
scss/modules/_variables.scss
+2
-0
2 additions, 0 deletions
scss/modules/_variables.scss
with
17 additions
and
6 deletions
lib/map/labelslayer.js
+
5
−
4
View file @
8c497817
...
@@ -10,8 +10,8 @@ define(['leaflet', 'rbush', 'helper'],
...
@@ -10,8 +10,8 @@ define(['leaflet', 'rbush', 'helper'],
[
'
right
'
,
'
top
'
,
5
/
8
],
[
'
right
'
,
'
top
'
,
5
/
8
],
[
'
center
'
,
'
ideographic
'
,
2
/
8
],
[
'
center
'
,
'
ideographic
'
,
2
/
8
],
[
'
right
'
,
'
ideographic
'
,
3
/
8
]];
[
'
right
'
,
'
ideographic
'
,
3
/
8
]];
var
bodyStyle
=
window
.
getComputedStyle
(
document
.
querySelector
(
'
body
'
));
var
labelShadow
;
var
labelShadow
;
var
bodyStyle
=
{
fontFamily
:
'
sans-serif
'
};
var
nodeRadius
=
4
;
var
nodeRadius
=
4
;
var
cFont
=
document
.
createElement
(
'
canvas
'
).
getContext
(
'
2d
'
);
var
cFont
=
document
.
createElement
(
'
canvas
'
).
getContext
(
'
2d
'
);
...
@@ -101,11 +101,10 @@ define(['leaflet', 'rbush', 'helper'],
...
@@ -101,11 +101,10 @@ define(['leaflet', 'rbush', 'helper'],
// - label (string)
// - label (string)
// - color (string)
// - color (string)
var
labelsOnline
=
d
.
online
.
map
(
prepareLabel
(
bodyStyle
.
color
,
11
,
8
,
true
));
var
labelsOnline
=
d
.
online
.
map
(
prepareLabel
(
null
,
11
,
8
,
true
));
var
labelsOffline
=
d
.
offline
.
map
(
prepareLabel
(
'
rgba(212, 62, 42, 0.9)
'
,
9
,
5
,
false
));
var
labelsOffline
=
d
.
offline
.
map
(
prepareLabel
(
'
rgba(212, 62, 42, 0.9)
'
,
9
,
5
,
false
));
var
labelsNew
=
d
.
new
.
map
(
prepareLabel
(
'
rgba(48, 99, 20, 0.9)
'
,
11
,
8
,
true
));
var
labelsNew
=
d
.
new
.
map
(
prepareLabel
(
'
rgba(48, 99, 20, 0.9)
'
,
11
,
8
,
true
));
var
labelsLost
=
d
.
lost
.
map
(
prepareLabel
(
'
rgba(212, 62, 42, 0.9)
'
,
11
,
8
,
true
));
var
labelsLost
=
d
.
lost
.
map
(
prepareLabel
(
'
rgba(212, 62, 42, 0.9)
'
,
11
,
8
,
true
));
labelShadow
=
bodyStyle
.
backgroundColor
.
replace
(
/rgb/i
,
'
rgba
'
).
replace
(
/
\)
/i
,
'
,0.7)
'
);
var
labels
=
[]
var
labels
=
[]
.
concat
(
labelsNew
)
.
concat
(
labelsNew
)
...
@@ -193,6 +192,8 @@ define(['leaflet', 'rbush', 'helper'],
...
@@ -193,6 +192,8 @@ define(['leaflet', 'rbush', 'helper'],
var
tileSize
=
this
.
options
.
tileSize
;
var
tileSize
=
this
.
options
.
tileSize
;
var
s
=
tilePoint
.
multiplyBy
(
tileSize
);
var
s
=
tilePoint
.
multiplyBy
(
tileSize
);
var
map
=
this
.
_map
;
var
map
=
this
.
_map
;
bodyStyle
=
window
.
getComputedStyle
(
document
.
querySelector
(
'
body
'
));
labelShadow
=
bodyStyle
.
backgroundColor
.
replace
(
/rgb/i
,
'
rgba
'
).
replace
(
/
\)
/i
,
'
,0.7)
'
);
function
projectNodes
(
d
)
{
function
projectNodes
(
d
)
{
var
p
=
map
.
project
(
d
.
label
.
position
);
var
p
=
map
.
project
(
d
.
label
.
position
);
...
@@ -215,7 +216,7 @@ define(['leaflet', 'rbush', 'helper'],
...
@@ -215,7 +216,7 @@ define(['leaflet', 'rbush', 'helper'],
ctx
.
font
=
d
.
label
.
font
;
ctx
.
font
=
d
.
label
.
font
;
ctx
.
textAlign
=
d
.
label
.
anchor
[
0
];
ctx
.
textAlign
=
d
.
label
.
anchor
[
0
];
ctx
.
textBaseline
=
d
.
label
.
anchor
[
1
];
ctx
.
textBaseline
=
d
.
label
.
anchor
[
1
];
ctx
.
fillStyle
=
d
.
label
.
fillStyle
;
ctx
.
fillStyle
=
d
.
label
.
fillStyle
===
null
?
bodyStyle
.
color
:
d
.
label
.
fillStyle
;
if
(
d
.
label
.
stroke
)
{
if
(
d
.
label
.
stroke
)
{
ctx
.
strokeText
(
d
.
label
.
label
,
d
.
p
.
x
+
d
.
label
.
offset
[
0
],
d
.
p
.
y
+
d
.
label
.
offset
[
1
]);
ctx
.
strokeText
(
d
.
label
.
label
,
d
.
p
.
x
+
d
.
label
.
offset
[
0
],
d
.
p
.
y
+
d
.
label
.
offset
[
1
]);
...
...
This diff is collapsed.
Click to expand it.
lib/sidebar.js
+
10
−
2
View file @
8c497817
...
@@ -4,6 +4,12 @@ define(function () {
...
@@ -4,6 +4,12 @@ define(function () {
return
function
(
el
)
{
return
function
(
el
)
{
var
self
=
this
;
var
self
=
this
;
// Needed to avoid render blocking
var
gridBreakpoints
=
{
lg
:
[
992
,
446
],
xl
:
[
1200
,
560
]
};
var
sidebar
=
document
.
createElement
(
'
div
'
);
var
sidebar
=
document
.
createElement
(
'
div
'
);
sidebar
.
classList
.
add
(
'
sidebar
'
);
sidebar
.
classList
.
add
(
'
sidebar
'
);
el
.
appendChild
(
sidebar
);
el
.
appendChild
(
sidebar
);
...
@@ -21,10 +27,12 @@ define(function () {
...
@@ -21,10 +27,12 @@ define(function () {
sidebar
.
appendChild
(
container
);
sidebar
.
appendChild
(
container
);
self
.
getWidth
=
function
getWidth
()
{
self
.
getWidth
=
function
getWidth
()
{
if
(
sidebar
.
classList
.
contains
(
'
hidden
'
)
||
button
.
offsetHeight
===
0
)
{
if
(
gridBreakpoints
.
lg
[
0
]
<
window
.
innerWidth
)
{
return
0
;
return
0
;
}
else
if
(
gridBreakpoints
.
xl
[
0
]
<
window
.
innerWidth
)
{
return
gridBreakpoints
.
lg
[
1
];
}
}
return
sidebar
.
offsetWidth
;
return
gridBreakpoints
.
xl
[
1
]
;
};
};
self
.
add
=
function
add
(
d
)
{
self
.
add
=
function
add
(
d
)
{
...
...
This diff is collapsed.
Click to expand it.
scss/modules/_variables.scss
+
2
−
0
View file @
8c497817
...
@@ -21,6 +21,7 @@ $button-font-size: 1.6rem !default;
...
@@ -21,6 +21,7 @@ $button-font-size: 1.6rem !default;
$button-distance
:
16px
!
default
;
$button-distance
:
16px
!
default
;
// Bootstrap breakpoints
// Bootstrap breakpoints
// In lib/sidebar to avoid render blocking onload
$grid-breakpoints
:
(
$grid-breakpoints
:
(
//
Extra
small
screen
/
phone
//
Extra
small
screen
/
phone
xs
:
0
,
xs
:
0
,
...
@@ -35,6 +36,7 @@ $grid-breakpoints: (
...
@@ -35,6 +36,7 @@ $grid-breakpoints: (
)
!
default
;
)
!
default
;
// 45% sidebar - based on viewport
// 45% sidebar - based on viewport
// In lib/sidebar to avoid render blocking onload
$sidebar-width
:
map-get
(
$grid-breakpoints
,
xl
)
*
.45
!
default
;
$sidebar-width
:
map-get
(
$grid-breakpoints
,
xl
)
*
.45
!
default
;
$sidebar-width-small
:
map-get
(
$grid-breakpoints
,
lg
)
*
.45
!
default
;
$sidebar-width-small
:
map-get
(
$grid-breakpoints
,
lg
)
*
.45
!
default
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment