Skip to content

Commit

Permalink
Make tool bar sticky
Browse files Browse the repository at this point in the history
  • Loading branch information
McDoyen committed May 9, 2018
1 parent 2a3026c commit 9ba9754
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 9 deletions.
7 changes: 4 additions & 3 deletions demo/build/darkroom.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions demo/build/darkroom.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ <h2>Contributing</h2>
</div>

<script src="./vendor/fabric.js"></script>
<script src="./vendor/stickyfill.min.js"></script>
<script src="./build/darkroom.js"></script>

<script>
Expand Down
6 changes: 6 additions & 0 deletions demo/vendor/stickyfill.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions lib/css/_toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
.darkroom-toolbar {
display: flex;
flex-wrap: wrap;
position: initial;
top: -45px;
position: sticky;
position: -webkit-sticky;
top: 10px;
left: 0;
background: #444;
height: auto;
Expand Down
3 changes: 3 additions & 0 deletions lib/js/core/darkroom.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@
imageElement.style.display = 'none';
mainContainerElement.appendChild(imageElement);

Stickyfill.add(toolbarElement);
Stickyfill.refreshAll();

// Instanciate object from elements
this.containerElement = mainContainerElement;
this.originalImageElement = imageElement;
Expand Down
2 changes: 1 addition & 1 deletion lib/js/plugins/darkroom.crop.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
snapshot.src = canvas.toDataURL({
left: left,
top: top,
width: top,
width: width,
height: height
});
}
Expand Down
5 changes: 5 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"dependencies": {
"eslint": "^4.18.2",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "^2.9.0"
"eslint-plugin-import": "^2.9.0",
"stickyfilljs": "^2.0.3"
},
"devDependencies": {
"gulp": "^3.9.0",
Expand Down

0 comments on commit 9ba9754

Please sign in to comment.