mirror of
https://github.com/viliusle/miniPaint.git
synced 2026-02-06 17:26:44 +00:00
layer translate (change position)
This commit is contained in:
parent
ea3f02901e
commit
98e7ebdf90
@ -201,6 +201,7 @@
|
||||
<li><a class="trn" onclick="call_menu(LAYER, 'layer_move_down');" href="#">Down</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a class="trn dots" onclick="call_menu(LAYER, 'layer_translate');" href="#">Translate </a></li>
|
||||
<li><a class="trn dots" onclick="call_menu(LAYER, 'layer_opacity');" href="#">Opacity</a></li>
|
||||
<li><a class="trn dots" onclick="call_menu(LAYER, 'layer_rename');" href="#">Rename</a></li>
|
||||
<li><div class="mid-line"></div></li>
|
||||
|
||||
19
js/layers.js
19
js/layers.js
@ -31,6 +31,25 @@ function LAYER_CLASS() {
|
||||
this.layer_add();
|
||||
};
|
||||
|
||||
//remaps layer at different position
|
||||
this.layer_translate = function () {
|
||||
POP.add({name: "x", title: "X position:", value: 0});
|
||||
POP.add({name: "y", title: "Y position:", value: 0});
|
||||
POP.show('Translate to', [LAYER, 'layer_translate_custom']);
|
||||
};
|
||||
|
||||
//transalte handler for layer_translate()
|
||||
this.layer_translate_custom = function(user_response){
|
||||
EDIT.save_state();
|
||||
var x = parseInt(user_response.x);
|
||||
var y = parseInt(user_response.y);
|
||||
|
||||
//move
|
||||
var tmp = canvas_active().getImageData(0, 0, WIDTH, HEIGHT);
|
||||
canvas_active().clearRect(0, 0, WIDTH, HEIGHT);
|
||||
canvas_active().putImageData(tmp, x, y);
|
||||
};
|
||||
|
||||
//removes all layers
|
||||
this.remove_all_layers = function(){
|
||||
//delete old layers
|
||||
|
||||
Loading…
Reference in New Issue
Block a user