Created
June 7, 2016 00:24
-
-
Save jasongilman/47a52766bb59be7b77fd6f76676f6925 to your computer and use it in GitHub Desktop.
Atom Canvas Block Decoration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Paste this into the inspector in Atom. | |
var element = document.createElement('div') | |
var canvas = document.createElement("canvas") | |
element.appendChild(canvas) | |
element.style.setProperty("width", "100%") | |
element.style.setProperty("height", "150px") | |
canvas.style.setProperty("width", "100%") | |
canvas.style.setProperty("height", "100%") | |
canvas.style.setProperty("background-color", "white") | |
var editor = atom.workspace.getActiveTextEditor() | |
var marker = editor.markScreenPosition([0, 0]) | |
editor.decorateMarker(marker, {type: 'block', position: 'before', item: element}) | |
ctx = canvas.getContext("2d") | |
ctx.beginPath() | |
ctx.moveTo(0,0) | |
ctx.lineTo(25,24) | |
ctx.stroke() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment