WIP - Remove canvas and use HTML/CSS
Browse files- src/core/overlay.js +11 -10
- src/driver.scss +12 -2
src/core/overlay.js
CHANGED
@@ -102,10 +102,8 @@ export default class Overlay {
|
|
102 |
this.highlightedElement = null;
|
103 |
this.lastHighlightedElement = null;
|
104 |
|
105 |
-
this.pageOverlay.style.
|
106 |
this.highlightStage.style.display = 'none';
|
107 |
-
|
108 |
-
this.draw();
|
109 |
}
|
110 |
|
111 |
/**
|
@@ -118,19 +116,22 @@ export default class Overlay {
|
|
118 |
return;
|
119 |
}
|
120 |
|
|
|
|
|
|
|
121 |
// Show the overlay
|
122 |
-
this.pageOverlay.style.
|
123 |
-
this.highlightStage.style.display = 'block';
|
124 |
|
125 |
-
const
|
|
|
126 |
|
127 |
// Show the stage
|
128 |
this.highlightStage.style.display = 'block';
|
129 |
this.highlightStage.style.position = 'absolute';
|
130 |
-
this.highlightStage.style.width = `${
|
131 |
-
this.highlightStage.style.height = `${
|
132 |
-
this.highlightStage.style.top = `${this.positionToHighlight.top}px`;
|
133 |
-
this.highlightStage.style.left = `${this.positionToHighlight.left}px`;
|
134 |
|
135 |
// Element has been highlighted
|
136 |
this.highlightedElement.onHighlighted();
|
|
|
102 |
this.highlightedElement = null;
|
103 |
this.lastHighlightedElement = null;
|
104 |
|
105 |
+
this.pageOverlay.style.opacity = '0';
|
106 |
this.highlightStage.style.display = 'none';
|
|
|
|
|
107 |
}
|
108 |
|
109 |
/**
|
|
|
116 |
return;
|
117 |
}
|
118 |
|
119 |
+
// Make it two times the padding because, half will be given on left and half on right
|
120 |
+
const requiredPadding = this.options.padding * 2;
|
121 |
+
|
122 |
// Show the overlay
|
123 |
+
this.pageOverlay.style.opacity = `${this.options.opacity}`;
|
|
|
124 |
|
125 |
+
const width = (this.positionToHighlight.right - this.positionToHighlight.left) + (requiredPadding);
|
126 |
+
const height = (this.positionToHighlight.bottom - this.positionToHighlight.top) + (requiredPadding);
|
127 |
|
128 |
// Show the stage
|
129 |
this.highlightStage.style.display = 'block';
|
130 |
this.highlightStage.style.position = 'absolute';
|
131 |
+
this.highlightStage.style.width = `${width}px`;
|
132 |
+
this.highlightStage.style.height = `${height}px`;
|
133 |
+
this.highlightStage.style.top = `${this.positionToHighlight.top - (requiredPadding / 2)}px`;
|
134 |
+
this.highlightStage.style.left = `${this.positionToHighlight.left - (requiredPadding / 2)}px`;
|
135 |
|
136 |
// Element has been highlighted
|
137 |
this.highlightedElement.onHighlighted();
|
src/driver.scss
CHANGED
@@ -108,16 +108,21 @@ div#driver-popover-item {
|
|
108 |
}
|
109 |
|
110 |
div#driver-page-overlay {
|
111 |
-
display:
|
112 |
width: 100%;
|
113 |
height: 100%;
|
114 |
background: black;
|
115 |
top: 0;
|
116 |
left: 0;
|
117 |
position: fixed;
|
118 |
-
opacity: 0
|
119 |
pointer-events: none;
|
120 |
z-index: 100002 !important;
|
|
|
|
|
|
|
|
|
|
|
121 |
}
|
122 |
|
123 |
div#driver-highlighted-element-stage {
|
@@ -129,6 +134,11 @@ div#driver-highlighted-element-stage {
|
|
129 |
background: white;
|
130 |
z-index: 100003 !important;
|
131 |
display: none;
|
|
|
|
|
|
|
|
|
|
|
132 |
}
|
133 |
|
134 |
.driver-highlighted-element {
|
|
|
108 |
}
|
109 |
|
110 |
div#driver-page-overlay {
|
111 |
+
display: block;
|
112 |
width: 100%;
|
113 |
height: 100%;
|
114 |
background: black;
|
115 |
top: 0;
|
116 |
left: 0;
|
117 |
position: fixed;
|
118 |
+
opacity: 0;
|
119 |
pointer-events: none;
|
120 |
z-index: 100002 !important;
|
121 |
+
-webkit-transition: all 0.2s;
|
122 |
+
-moz-transition: all 0.2s;
|
123 |
+
-ms-transition: all 0.2s;
|
124 |
+
-o-transition: all 0.2s;
|
125 |
+
transition: all 0.2s;
|
126 |
}
|
127 |
|
128 |
div#driver-highlighted-element-stage {
|
|
|
134 |
background: white;
|
135 |
z-index: 100003 !important;
|
136 |
display: none;
|
137 |
+
-webkit-transition: all 0.2s;
|
138 |
+
-moz-transition: all 0.2s;
|
139 |
+
-ms-transition: all 0.2s;
|
140 |
+
-o-transition: all 0.2s;
|
141 |
+
transition: all 0.2s;
|
142 |
}
|
143 |
|
144 |
.driver-highlighted-element {
|