从输入更改宽度阶段 [英] change width stage from input

查看:116
本文介绍了从输入更改宽度阶段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮我吗?

我有一个舞台和图像,我想更改输入的宽度和高度. 这是代码,它不起作用:/帮帮我.)

I have a stage and image and i want to change width and height from input. this is code and it does no work :/ help me.)

var stage = new Kinetic.Stage({ 容器:"containerCreator", 宽度:imageWidth, 高度:imageHeight });

var stage = new Kinetic.Stage({ container: 'containerCreator', width: imageWidth, height: imageHeight });

var layer = new Kinetic.Layer();

var imageObj = new Image();
imageObj.onload = function(){
  var yoda = new Kinetic.Image({
    x: 0,
    y: 0,
    image: imageObj,
    width: imageWidth,
    height: imageHeight
  });



  layer.add(yoda);
  layer.add(vrchnyText);
  stage.add(layer);  

  };
  imageObj.src = imageSource;

  $('#vrchCreator').keyup(function(){

    stage.width = $(this).val();        
    stage.height= $(this).val();    
    layer.add(yoda);
    stage.add(layer);  

});

推荐答案

您要将其更改为:

$('#vrchCreator').keyup(function()
{ 
   stage.setWidth(parseInt($(this).val()));
   stage.setHeight(parseInt($(this).val()));
   layer.add(yoda);
   stage.add(layer);  

});

这篇关于从输入更改宽度阶段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆