custom color picker
This commit is contained in:
parent
c67c2b4c50
commit
7b8af3eeea
53 changed files with 988 additions and 519 deletions
|
|
@ -216,7 +216,7 @@ module.exports = {
|
|||
this._customBindings['drag'] !== 0 ||
|
||||
this._customBindings['draginit'] !== 0 ||
|
||||
this._customBindings['dragend'] !== 0 ||
|
||||
!options
|
||||
!options || options.ignoreCustomBindings
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
|
@ -243,7 +243,7 @@ module.exports = {
|
|||
this._customBindings['drag'] !== 0 ||
|
||||
this._customBindings['draginit'] !== 0 ||
|
||||
this._customBindings['dragend'] !== 0 ||
|
||||
!options
|
||||
!options || options.ignoreCustomBindings
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
52
src/client/events/transform-coords.js
Normal file
52
src/client/events/transform-coords.js
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
|
||||
Adapted from https://gist.github.com/Yaffle/1145197#file-convertpointfrompagetonode-js
|
||||
|
||||
Disabled for now
|
||||
|
||||
*/
|
||||
|
||||
|
||||
var I = new WebKitCSSMatrix()
|
||||
|
||||
function Point(x, y, z) {
|
||||
this.x = x
|
||||
this.y = y
|
||||
this.z = z
|
||||
}
|
||||
|
||||
Point.prototype.transformBy = function(matrix) {
|
||||
var tmp = matrix.multiply(I.translate(this.x, this.y, this.z))
|
||||
return new Point(tmp.m41, tmp.m42, tmp.m43)
|
||||
}
|
||||
|
||||
function getTransformationMatrix(w) {
|
||||
|
||||
var transformationMatrix = I,
|
||||
node = w
|
||||
|
||||
while (node) {
|
||||
if (node._ignore_css_transforms) break
|
||||
if (node._drag_widget) {
|
||||
|
||||
var transform = node._drag_widget.cssTransform || 'none',
|
||||
c = transform === 'none' ? I : new WebKitCSSMatrix(transform)
|
||||
|
||||
transformationMatrix = c.multiply(transformationMatrix)
|
||||
|
||||
}
|
||||
node = node.parentNode
|
||||
|
||||
}
|
||||
|
||||
transformationMatrix = I.multiply(transformationMatrix)
|
||||
|
||||
return transformationMatrix
|
||||
|
||||
}
|
||||
|
||||
module.export = function cssTransformCoords(node, x, y) {
|
||||
|
||||
return new Point(pageX, pageY, 0).transformBy(getTransformationMatrix(element).inverse())
|
||||
|
||||
}
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
const Touch = window.Touch || class Touch {}
|
||||
// const cssTransformCoords = require('./transform-coords')
|
||||
|
||||
|
||||
module.exports = {
|
||||
|
||||
|
|
@ -76,6 +78,12 @@ module.exports = {
|
|||
}
|
||||
|
||||
|
||||
// if (!event.traversing) {
|
||||
// // css transfom fix (doesn't work well with traversing gestures)
|
||||
// var transformedCoords = cssTransformCoords(event.firstTarget, event.movementX, event.movementY)
|
||||
// event.movementX = transformedCoords.x
|
||||
// event.movementY = transformedCoords.y
|
||||
// }
|
||||
|
||||
return event
|
||||
|
||||
|
|
@ -88,6 +96,13 @@ module.exports = {
|
|||
event.offsetX = event.pageX - off.left
|
||||
event.offsetY = event.pageY - off.top
|
||||
|
||||
// if (!event.traversing) {
|
||||
// // css transfom fix (doesn't work well with traversing gestures)
|
||||
// var transformedCoords = cssTransformCoords(event.firstTarget, event.offsetX, event.offsetY)
|
||||
// event.offsetX = transformedCoords.x
|
||||
// event.offsetY = transformedCoords.y
|
||||
// }
|
||||
|
||||
},
|
||||
|
||||
TRAVERSING_SAMEWIDGET: 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue