Last active
February 8, 2018 19:29
-
-
Save levvsha/93184dff267e360f888ad4f1690fb5ad to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const preview = d3.select('.preview') | |
| .append('svg') | |
| .attr('width', previewWidth + previewMargin.left + previewMargin.right) | |
| .attr('height', previewHeight + previewMargin.top + previewMargin.bottom) | |
| .append('g') | |
| .attr('transform', `translate(${ previewMargin.left },${ previewMargin.top })`); | |
| const previewContainer = preview.append('g'); | |
| preview.append('g') | |
| .attr('class', 'preview-axis x-axis') | |
| .attr('transform', `translate(0,${ previewHeight })`) | |
| .call(xAxisPreview); | |
| preview.append('g') | |
| .attr('class', 'preview-axis y-axis') | |
| .attr('transform', 'translate(0, 0)') | |
| .call(yAxisPreview); | |
| previewContainer.append('rect') | |
| .attr('x', 0) | |
| .attr('y', 0) | |
| .attr('width', previewWidth) | |
| .attr('height', previewHeight) | |
| .attr('fill', '#dedede'); | |
| /* ... */ | |
| const draggedNode = previewContainer | |
| .append('rect') | |
| .data([{ x: 0, y: 0 }]) | |
| .attr('x', 0) | |
| .attr('y', 0) | |
| .attr('width', previewWidth) | |
| .attr('height', previewHeight) | |
| .attr('fill', 'rgba(250, 235, 215, 0.78)') | |
| .style('cursor', 'move') | |
| .call(d3.drag().on('drag', dragged)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment