Skip to content

Commit

Permalink
Merge pull request #1 from shokosmo/class-#49
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
Ayato0404 committed May 31, 2016
2 parents bafc989 + b7ceb21 commit 1c174cd
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 21 deletions.
1 change: 1 addition & 0 deletions js/canvas-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class CanvasModel {
this.element = element;
this.context = this.element.getContext("2d");
}
// 外からはアクセスしないでください。
getImageData() {
return this.context.getImageData(0, 0,
this.element.width, this.element.height);
Expand Down
2 changes: 1 addition & 1 deletion js/drawing-configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class DrawingConfiguration {
this.lineWidth = lineWidth;
});
eventPublisher.publish("lineWidth", 10);
}
}
}

export default DrawingConfiguration;
2 changes: 1 addition & 1 deletion js/frames-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import CanvasModel from "./canvas-model";

// frame の追加・削除、currentFrameの切り替えをModel上で行う
class FramesController{
constructor() {
constructor(canvas) {
let updateImageDataToNextData;
this.frames = [];
this.currentFrameId = 0;
Expand Down
6 changes: 3 additions & 3 deletions js/paint-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let isMouseDown = false;
let previousMousePosition;
// HTMLCanvasElementをラップし, canvasRenderingContext2Dに関する操作を提供する
class PaintManager{
constructor() {
constructor(element) {
let changeDrawState;

this.element = element;
Expand Down Expand Up @@ -41,7 +41,7 @@ class PaintManager{
});
}

mouseDownCanvas() {
mouseDownCanvas(event) {
if (!this.isLock) {
isMouseDown = true;
previousMousePosition = { x: event.clientX, y: event.clientY };
Expand All @@ -55,7 +55,7 @@ class PaintManager{
eventPublisher.publish("drawState", "idling");
}
}
mouseMoveCanvas() {
mouseMoveCanvas(event) {
if (!this.isLock) {
if (isMouseDown) {
if (this.color === "white") {
Expand Down
4 changes: 2 additions & 2 deletions js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const playInterval = 250;
* 再生された時に他に必要な処理(Menuを隠すなど)は、各自クラスでsubscribeして行う。
*/
class Player{
constructor(){
constructor(framesController){
this.isPlaying = false;
this.playInterval = playInterval;
this.framesController = framesController;
Expand All @@ -25,7 +25,7 @@ class Player{
}


changeFrame() {
changeFrame(currentFrameId) {
let nextCurrentFrameId;
this.framesController.setCurrentFrame(currentFrameId);
if (currentFrameId >= this.framesController.frames.length - 1) {
Expand Down
2 changes: 1 addition & 1 deletion js/view-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import PlayerView from "./view/player-view";
import eventPublisher from "./publisher";

class ViewManager{
constructor(){
constructor(framesController){
this.colorPicker =
new ColorPickerView(document.getElementById("menu-colors"));
eventPublisher.subscribe("defaultPalleteColors", (colors) => {
Expand Down
6 changes: 3 additions & 3 deletions js/view/color-picker-view.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import eventPublisher from "./../publisher";

class colorpickerview{
constructor(){
constructor(elem){
this.element = elem;
eventPublisher.subscribe("color", (color) => {
let selectedPalette = this.element.querySelector(".selected-palette");
Expand All @@ -16,7 +16,7 @@ class colorpickerview{
});
}

addPalette(){
addPalette(color)){
let palette;

if (!isColor(color)) {
Expand All @@ -38,7 +38,7 @@ clearPalette(){
}

class isColor{
constructor(){
constructor(color){
const testElement = document.createElement("span");
testElement.style.backgroundColor = color;

Expand Down
8 changes: 4 additions & 4 deletions js/view/line-width-picker-view.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import eventPublisher from "./../publisher";

class LineWidthPickerPanel{
constructor(){
class LineWidthPickerPanel {
constructor(elem){
this.element = elem;
eventPublisher.subscribe("lineWidth", (lineWidth) => {
this.element.value = lineWidth;
Expand All @@ -11,12 +11,12 @@ class LineWidthPickerPanel{
});
}

changeMaxLineWidth(){
changeMaxLineWidth(maxLineWidth){

// TODO
};

changeMinLineWidth(){
changeMinLineWidth(minLineWidth){
// TODO
}
}
Expand Down
6 changes: 3 additions & 3 deletions js/view/menu-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class MenuView{
});
}

setMenuVisible(){
setMenuVisible(isOpen){
const menu = document.getElementById("menu");
const direction = isOpen ? "alternate" : "alternate-reverse";
this.isOpen = isOpen;
Expand All @@ -39,15 +39,15 @@ setMenuVisible(){
}
// collapsibleButton : メニューの右側にあるボタン

setCollapsibleButtonVisible(){
setCollapsibleButtonVisible(visible){
const collapsibleButton = document.getElementById("menu-collapsible-btn");
const direction = visible ? "alternate" : "alternate-reverse";
collapsibleButton.animate(
[{ transform: "translate(-30px)" }, { transform: "translate(0px)" }],
{ direction: direction, duration: 100, fill: "both" });
}

setCollapsibleButtonMode(){
setCollapsibleButtonMode(isPlaying){
this.isPlaying = isPlaying;
const icon = document.querySelector("#menu-collapsible-btn i");
if (isPlaying) {
Expand Down
6 changes: 3 additions & 3 deletions js/view/sequence-view.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import eventPublisher from "./../publisher";

class SequencePanel{
constructor(){
constructor(elem, framesController){
this.elem = elem;
this.maxFrameId = 0;
this.currentFrameId = 0;
Expand Down Expand Up @@ -63,7 +63,7 @@ class getFrameTemplate{

return frame;
}
append(){
append(frameId){
let newFrame = getFrameTemplate(frameId, (event) => {
// 子要素のmousedownによる発生を防ぐ
if (event.target.classList.contains("thumbnail")) {
Expand All @@ -81,7 +81,7 @@ class getFrameTemplate{
clear(){
this.elem.innerHTML = "";
}
remove(){
remove(frame){
}
moveUp(){
// TODO
Expand Down

0 comments on commit 1c174cd

Please sign in to comment.