Merge branch 'master' of https://gitea.iwm-tuebingen.de/IWMBrowser/iwmlib
* 'master' of https://gitea.iwm-tuebingen.de/IWMBrowser/iwmlib: Changed scale Updated to PixiJS 5.2.1.
This commit is contained in:
+17
-14
@@ -27,6 +27,9 @@ function round(value) {
|
||||
* @class Highlight
|
||||
* @extends {Object}
|
||||
*/
|
||||
|
||||
const SCALE = 1.5
|
||||
|
||||
export default class Highlight extends Object {
|
||||
static disableAnimations() {
|
||||
_HighlightEnabled = false
|
||||
@@ -75,12 +78,12 @@ export default class Highlight extends Object {
|
||||
}
|
||||
}
|
||||
|
||||
static expand(obj, { scale = 2, duration = 3, stroke = 2, onComplete = null } = {}) {
|
||||
static expand(obj, { scale = SCALE, duration = 3, stroke = 2, onComplete = null } = {}) {
|
||||
if (obj == null) return
|
||||
//console.log("expand")
|
||||
//console.log("expand")
|
||||
obj.classList.add('zooming')
|
||||
TweenLite.to(obj, duration, {
|
||||
scale: scale,
|
||||
scale,
|
||||
onUpdate: () => {
|
||||
let scale = obj._gsTransform.scaleX
|
||||
obj.setAttribute('stroke-width', stroke / scale)
|
||||
@@ -116,20 +119,20 @@ export default class Highlight extends Object {
|
||||
|
||||
static animateCircle(target, callback) {
|
||||
console.log('ANIMATE CIRCLE', this)
|
||||
// ** DEBUG OUTPUTS **
|
||||
// ** DEBUG OUTPUTS **
|
||||
|
||||
let circle = target
|
||||
// We need a unique id to ensure correspondence between circle, mask, and maskImage
|
||||
// We need a unique id to ensure correspondence between circle, mask, and maskImage
|
||||
if (!circle.hasAttribute('id')) {
|
||||
_CircleIds += 1
|
||||
circle.setAttribute('id', '@@' + _CircleIds)
|
||||
}
|
||||
let id = circle.getAttribute('id')
|
||||
TweenLite.set(circle, { transformOrigin: '50% 50%' })
|
||||
/*if (circle.classList.contains('zooming')) {
|
||||
console.log("already zooming")
|
||||
return
|
||||
}*/
|
||||
/*if (circle.classList.contains('zooming')) {
|
||||
console.log("already zooming")
|
||||
return
|
||||
}*/
|
||||
|
||||
let svgRoot = circle.closest('svg')
|
||||
let circleGroup = circle.parentNode
|
||||
@@ -180,7 +183,7 @@ export default class Highlight extends Object {
|
||||
return false
|
||||
}
|
||||
|
||||
static openHighlight(target, { animation = 0.5, scale = 2, onExpanded = null } = {}) {
|
||||
static openHighlight(target, { animation = 0.5, scale = SCALE, onExpanded = null } = {}) {
|
||||
if (Highlight._isExpanded(target)) {
|
||||
console.log('Target is already expanded!')
|
||||
return
|
||||
@@ -325,7 +328,7 @@ export default class Highlight extends Object {
|
||||
}
|
||||
|
||||
svgGroup.appendChild(maskImage)
|
||||
// svgGroup.appendChild(element)
|
||||
// svgGroup.appendChild(element)
|
||||
|
||||
return [mask, maskImage]
|
||||
}
|
||||
@@ -347,7 +350,7 @@ export default class Highlight extends Object {
|
||||
|
||||
static closeHighlight(target, { animation = 0.5 } = {}) {
|
||||
target.classList.remove(Highlight.expandedClass)
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
let [mask, maskImage] = Highlight._getSVGMask(target)
|
||||
console.log('Close Highlight', maskImage)
|
||||
TweenLite.to([target, maskImage], animation, {
|
||||
@@ -366,7 +369,7 @@ export default class Highlight extends Object {
|
||||
|
||||
static _retrieveId(target) {
|
||||
let id = target.getAttribute('id')
|
||||
// We need a unique id to ensure correspondence between circle, mask, and maskImage
|
||||
// We need a unique id to ensure correspondence between circle, mask, and maskImage
|
||||
if (!id) {
|
||||
_CircleIds += 1
|
||||
target.setAttribute('id', '@@' + _CircleIds)
|
||||
@@ -379,4 +382,4 @@ export default class Highlight extends Object {
|
||||
}
|
||||
}
|
||||
|
||||
Highlight.expandedClass = 'expanded'
|
||||
Highlight.expandedClass = 'expanded'
|
||||
Reference in New Issue
Block a user