Skip to content
Snippets Groups Projects
Commit f787b23c authored by Clayton, Brandon Scott's avatar Clayton, Brandon Scott
Browse files

Merge branch 'rotate' into 'main'

allow drag and rotate

See merge request !29
parents d07e6b4d 70a95df7
No related branches found
No related tags found
1 merge request!29allow drag and rotate
Pipeline #485326 passed with warnings
......@@ -132,6 +132,29 @@ var DisaggGraphView = function (options) {
_this.d33d.renderLegend = _this.renderLegend;
_this.render();
var dragging = false;
var origin = {
x: 0,
y: 0,
};
d3.select(_this.d33d.el)
.on('mousedown', event => {
origin.x = event.clientX;
origin.y = event.clientY;
dragging = true;
})
.on('mousemove', event => {
if (dragging) {
var dx = event.clientX - origin.x;
var dz = event.clientY - origin.y;
_this.setOrigin(280 - dx, -150, 180 + dz)
}
})
.on('mouseup', () => {
dragging = false
})
};
/**
......@@ -707,6 +730,18 @@ var DisaggGraphView = function (options) {
el.attr('transform', 'translate(' + -bbox.width + ' 0)');
};
/**
* Set the views origin.
* @param {number} x
* @param {number} y
* @param {number} z
*/
_this.setOrigin = function (x, y, z) {
_this.d33d.model.set({
'origin': [x, y, z]
});
}
_initialize(options);
options = null;
return _this;
......
.DisaggGraphView {
user-select: none;
.tooltip-content {
.title {
font-size: 12px;
......
......@@ -106,4 +106,13 @@ export class DisaggGraphView extends SelectedCollectionView<DisaggGraphViewOptio
* element where legend should be rendered.
*/
renderLegend(info: Info): void;
/**
* Set the view origin.
*
* @param x The X origin
* @param y The Y origin
* @param z The Z origin
*/
setOrigin(x: number, y: number, z: number): void;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment