Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

[help]Fix #109 #114

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
<div id="thumbnails">
</div>
<button class="frame-add" id="sequence-add-btn"><i class="fa fa-plus"></i></button>

</div>
<button id="tesxx" > xxxxx </button>
</div>
</body>
</html>
27 changes: 27 additions & 0 deletions js/history.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import eventPublisher from "./publisher";

function test(framescontroller){

let currentFrame = framescontroller.getCurrentFrame();
let frames=[];
//framesは各frameのarrayを入れる。e.g. frame[1]には2つめのframeidのidlingごとgetImageDataしたarray
let currentframeID=framescontroller.currentFrameId;
for(let i=currentframeID;0<=i;i--){
console.log("tess");
frames[i]=[];
frames[i].push(framescontroller.canvasModel.getImageData());
}

eventPublisher.subscribe("drawState",(state)=>{
if(state=="idling"){
frames[framescontroller.currentFrameId].push(framescontroller.canvasModel.getImageData());
}
});
eventPublisher.subscribe("currentFrameId", (frameid)=>{
if(typeof frames[frameid] ==="undefined"){
frames[frameid]=[];
}
});
}

export default test;
4 changes: 4 additions & 0 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import DrawingConfiguration from "./drawing-configuration";
import ViewManager from "./view-manager";
import PaintManager from "./paint-manager";
import Player from "./player";
import test from "./history.js";


// webpack
import "./../css/style.css";
Expand Down Expand Up @@ -31,5 +33,7 @@ document.addEventListener("DOMContentLoaded", function() {

framesController.append(firstFrameId);
framesController.setCurrentFrame(firstFrameId);

test(framesController);
});