rel: In teardown, only reset data-x/y/z attribute if we modified it.
Fixes downstream bug in impressionist: https://github.com/henrikingo/impressionist/issues/20
This commit is contained in:
16
build.js
16
build.js
@@ -32,7 +32,9 @@ var output = files.map((f)=>{
|
||||
return fs.readFileSync(f).toString();
|
||||
}).join('\n')
|
||||
|
||||
fs.writeFileSync('js/impress.js', '// This file was automatically generated from files in src/ directory.\n\n' + output)
|
||||
var filename = 'js/impress.js';
|
||||
fs.writeFileSync(filename, '// This file was automatically generated from files in src/ directory.\n\n' + output)
|
||||
console.log(filename);
|
||||
|
||||
// terser --compress --mangle --comments '/^!/' --source-map --output js/impress.min.js js/impress.js
|
||||
var code = fs.readFileSync('js/impress.js').toString();
|
||||
@@ -46,8 +48,13 @@ var options = {
|
||||
}
|
||||
};
|
||||
var result = Terser.minify({'js/impress.js': code}, options);
|
||||
fs.writeFileSync('js/impress.min.js', result.code);
|
||||
fs.writeFileSync('js/impress.min.js.map', result.map);
|
||||
|
||||
filename = 'js/impress.min.js';
|
||||
fs.writeFileSync(filename, result.code);
|
||||
console.log(filename);
|
||||
filename = 'js/impress.min.js.map';
|
||||
fs.writeFileSync(filename, result.map);
|
||||
console.log(filename);
|
||||
|
||||
/* Auto generate an index.html that lists all the directories under examples/
|
||||
* This is useful for gh-pages, so you can link to http://impress.github.io/impress.js/examples
|
||||
@@ -62,5 +69,6 @@ var html = '<html>\n<head>\n<title>Example presentations</title>\n</head>\n<body
|
||||
html += '<h1>Example presentations</h1>\n' + html_list
|
||||
html += '</body>\n</html>'
|
||||
|
||||
var filename = path.resolve(__dirname, 'examples', 'index.html');
|
||||
filename = path.resolve(__dirname, 'examples', 'index.html');
|
||||
fs.writeFileSync(filename, html);
|
||||
console.log(filename);
|
||||
@@ -3721,7 +3721,10 @@
|
||||
el: el,
|
||||
x: el.getAttribute( "data-x" ),
|
||||
y: el.getAttribute( "data-y" ),
|
||||
z: el.getAttribute( "data-z" )
|
||||
z: el.getAttribute( "data-z" ),
|
||||
relX: el.getAttribute( "data-rel-x" ),
|
||||
relY: el.getAttribute( "data-rel-y" ),
|
||||
relZ: el.getAttribute( "data-rel-z" )
|
||||
} );
|
||||
var step = computeRelativePositions( el, prev );
|
||||
|
||||
@@ -3743,22 +3746,29 @@
|
||||
var steps = startingState[ root.id ];
|
||||
var step;
|
||||
while ( step = steps.pop() ) {
|
||||
// Reset x/y/z in cases where this plugin has changed it.
|
||||
if ( step.relX !== null ) {
|
||||
if ( step.x === null ) {
|
||||
step.el.removeAttribute( "data-x" );
|
||||
} else {
|
||||
step.el.setAttribute( "data-x", step.x );
|
||||
}
|
||||
}
|
||||
if ( step.relY !== null ) {
|
||||
if ( step.y === null ) {
|
||||
step.el.removeAttribute( "data-y" );
|
||||
} else {
|
||||
step.el.setAttribute( "data-y", step.y );
|
||||
}
|
||||
}
|
||||
if ( step.relZ !== null ) {
|
||||
if ( step.z === null ) {
|
||||
step.el.removeAttribute( "data-z" );
|
||||
} else {
|
||||
step.el.setAttribute( "data-z", step.z );
|
||||
}
|
||||
}
|
||||
}
|
||||
delete startingState[ root.id ];
|
||||
} );
|
||||
}, false );
|
||||
|
||||
@@ -159,7 +159,10 @@
|
||||
el: el,
|
||||
x: el.getAttribute( "data-x" ),
|
||||
y: el.getAttribute( "data-y" ),
|
||||
z: el.getAttribute( "data-z" )
|
||||
z: el.getAttribute( "data-z" ),
|
||||
relX: el.getAttribute( "data-rel-x" ),
|
||||
relY: el.getAttribute( "data-rel-y" ),
|
||||
relZ: el.getAttribute( "data-rel-z" )
|
||||
} );
|
||||
var step = computeRelativePositions( el, prev );
|
||||
|
||||
@@ -181,22 +184,29 @@
|
||||
var steps = startingState[ root.id ];
|
||||
var step;
|
||||
while ( step = steps.pop() ) {
|
||||
// Reset x/y/z in cases where this plugin has changed it.
|
||||
if ( step.relX !== null ) {
|
||||
if ( step.x === null ) {
|
||||
step.el.removeAttribute( "data-x" );
|
||||
} else {
|
||||
step.el.setAttribute( "data-x", step.x );
|
||||
}
|
||||
}
|
||||
if ( step.relY !== null ) {
|
||||
if ( step.y === null ) {
|
||||
step.el.removeAttribute( "data-y" );
|
||||
} else {
|
||||
step.el.setAttribute( "data-y", step.y );
|
||||
}
|
||||
}
|
||||
if ( step.relZ !== null ) {
|
||||
if ( step.z === null ) {
|
||||
step.el.removeAttribute( "data-z" );
|
||||
} else {
|
||||
step.el.setAttribute( "data-z", step.z );
|
||||
}
|
||||
}
|
||||
}
|
||||
delete startingState[ root.id ];
|
||||
} );
|
||||
}, false );
|
||||
|
||||
Reference in New Issue
Block a user