flot-plugins
Advanced tools
Comparing version 2.0.20 to 2.0.21
@@ -10,3 +10,4 @@ # National Instruments plugins | ||
- [Range Cursor](flot-range-cursor.md) | ||
- [Charting](flot-charting.md)\ | ||
- [Intensity graph](intensitygraph.md) | ||
- [Charting](flot-charting.md) | ||
- [Intensity graph](intensitygraph.md) | ||
- [Digital Waveform graph](flot-digital-waveform.md) |
@@ -916,5 +916,5 @@ /* The MIT License | ||
// cursor uses the default constrain function unless we provide one explicitly | ||
constraintFunction = cursor.horizontalThumbConstrain ? cursor.horizontalThumbConstrain : function (mouseX, mouseY, currentX, currentY) { | ||
constraintFunction = cursor.horizontalThumbConstrain ? cursor.horizontalThumbConstrain : function (mouseX, mouseY, currentX, currentY, thumbX, thumbY) { | ||
var offsetLeft = plot.offset().left, | ||
x = Math.max(offsetLeft, Math.min(mouseX, plot.width() + offsetLeft)); | ||
x = Math.max(offsetLeft, Math.min(thumbX, plot.width() + offsetLeft)) - thumbX + mouseX; | ||
return [x, currentY]; | ||
@@ -936,5 +936,5 @@ }; | ||
thumbCy = cursor.y + plotOffset.top; | ||
constraintFunction = cursor.verticalThumbConstrain ? cursor.verticalThumbConstrain : function (mouseX, mouseY, currentX, currentY) { | ||
constraintFunction = cursor.verticalThumbConstrain ? cursor.verticalThumbConstrain : function (mouseX, mouseY, currentX, currentY, thumbX, thumbY) { | ||
var offset = plot.offset(), | ||
y = Math.max(offset.top, Math.min(mouseY, plot.height() + offset.top)); | ||
y = Math.max(offset.top, Math.min(thumbY, plot.height() + offset.top)) - thumbY + mouseY; | ||
return [currentX, y]; | ||
@@ -941,0 +941,0 @@ }; |
@@ -153,12 +153,12 @@ /* The MIT License | ||
_createThumbConstrain(plot) { | ||
const horizontalThumbConstrain = (mouseX, mouseY, previousX, previousY) => { | ||
const horizontalThumbConstrain = (mouseX, mouseY, previousX, previousY, thumbX, thumbY) => { | ||
const thumb = this.thumbMoveState.selectedElement; | ||
const plotOffset = plot.getPlotOffset(); | ||
let x = mouseX; | ||
let thumbPositioned = false; | ||
if (this.thumbMoveState.inParkingLot) { | ||
const offset = plot.offset(); | ||
const mouseInGraph = mouseX >= offset.left && mouseX <= offset.left + plot.width(); | ||
if (mouseInGraph) { | ||
const thumbInGraph = thumbX >= offset.left && thumbX <= offset.left + plot.width(); | ||
if (thumbInGraph) { | ||
$.thumb.setHidden(thumb, false); | ||
const detail = { target: thumb, edge: this.thumbMoveState.parkingLotLocation, orientation: 'horizontal', position: mouseX - offset.left + plotOffset.left }; | ||
const detail = { target: thumb, edge: this.thumbMoveState.parkingLotLocation, orientation: 'horizontal', position: thumbX - offset.left + plotOffset.left }; | ||
if (this.thumbMoveState.axisHandle) { | ||
@@ -168,21 +168,21 @@ detail.axisHandle = this.thumbMoveState.axisHandle; | ||
this._dispatchThumbEvent('thumbIntoRange', detail, plot.getEventHolder()); | ||
x = previousX; | ||
thumbPositioned = true; | ||
this.thumbMoveState.inParkingLot = false; | ||
} | ||
} else { | ||
[this.thumbMoveState.inParkingLot, this.thumbMoveState.parkingLotLocation] = this._willHorizontalThumbBeMovedOffGraph(thumb, mouseX, plot); | ||
[this.thumbMoveState.inParkingLot, this.thumbMoveState.parkingLotLocation] = this._willHorizontalThumbBeMovedOffGraph(thumb, thumbX, plot); | ||
} | ||
return [x, previousY]; | ||
return [mouseX, previousY, thumbPositioned]; | ||
}; | ||
const verticalThumbConstrain = (mouseX, mouseY, previousX, previousY) => { | ||
const verticalThumbConstrain = (mouseX, mouseY, previousX, previousY, thumbX, thumbY) => { | ||
const thumb = this.thumbMoveState.selectedElement; | ||
const plotOffset = plot.getPlotOffset(); | ||
let y = mouseY; | ||
let thumbPositioned = false; | ||
if (this.thumbMoveState.inParkingLot) { | ||
const offset = plot.offset(); | ||
const mouseInGraph = mouseY >= offset.top && mouseY <= offset.top + plot.height(); | ||
if (mouseInGraph) { | ||
const thumbInGraph = thumbY >= offset.top && thumbY <= offset.top + plot.height(); | ||
if (thumbInGraph) { | ||
$.thumb.setHidden(thumb, false); | ||
const detail = { target: thumb, edge: this.thumbMoveState.parkingLotLocation, orientation: 'vertical', position: mouseY - offset.top + plotOffset.top }; | ||
const detail = { target: thumb, edge: this.thumbMoveState.parkingLotLocation, orientation: 'vertical', position: thumbY - offset.top + plotOffset.top }; | ||
if (this.thumbMoveState.axisHandle) { | ||
@@ -192,10 +192,10 @@ detail.axisHandle = this.thumbMoveState.axisHandle; | ||
this._dispatchThumbEvent('thumbIntoRange', detail, plot.getEventHolder()); | ||
y = previousY; | ||
thumbPositioned = true; | ||
this.thumbMoveState.inParkingLot = false; | ||
} | ||
} else { | ||
[this.thumbMoveState.inParkingLot, this.thumbMoveState.parkingLotLocation] = this._willVerticalThumbBeMovedOffGraph(thumb, mouseY, plot); | ||
[this.thumbMoveState.inParkingLot, this.thumbMoveState.parkingLotLocation] = this._willVerticalThumbBeMovedOffGraph(thumb, thumbY, plot); | ||
} | ||
return [previousX, y]; | ||
return [previousX, mouseY, thumbPositioned]; | ||
}; | ||
@@ -202,0 +202,0 @@ return { |
@@ -330,18 +330,22 @@ /* The MIT License | ||
var page = getEventXYPosition(evt), | ||
center = { x: page.X - currentState.deltaHandlingX, y: page.Y - currentState.deltaHandlingY }, | ||
target = extractTarget(evt), | ||
svgRoot = extractSVGFromTarget(target), | ||
eventHolder = svgRoot.eventHolder; | ||
eventHolder = svgRoot.eventHolder, | ||
positionHandled = false; | ||
if (currentState.selectedElement.constraintFunction) { | ||
[page.X, page.Y] = currentState.selectedElement.constraintFunction(page.X, page.Y, currentState.x, currentState.y); | ||
[page.X, page.Y, positionHandled] = currentState.selectedElement.constraintFunction(page.X, page.Y, currentState.x, currentState.y, center.x, center.y); | ||
} | ||
var currentMatrix = currentState.selectedElement.getCTM(), | ||
dx = page.X - currentState.x, | ||
dy = page.Y - currentState.y; | ||
if (!positionHandled) { | ||
var currentMatrix = currentState.selectedElement.getCTM(), | ||
dx = page.X - currentState.x, | ||
dy = page.Y - currentState.y; | ||
currentMatrix.e += dx; | ||
currentMatrix.f += dy; | ||
currentState.selectedElement.transform.baseVal.getItem(0).setMatrix(currentMatrix); | ||
} | ||
currentMatrix.e += dx; | ||
currentMatrix.f += dy; | ||
currentState.selectedElement.transform.baseVal.getItem(0).setMatrix(currentMatrix); | ||
//update last mouse position | ||
@@ -348,0 +352,0 @@ currentState.x = page.X; |
{ | ||
"name": "flot-plugins", | ||
"version": "2.0.20", | ||
"version": "2.0.21", | ||
"description": "A collection of plug-ins for flot charts", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5967260
141
18997