Commit 9a70b8e5 authored by nerrons's avatar nerrons

first time creating a prototype for k12

parent 04670509
Pipeline #1529 failed with stage
in 0 seconds
......@@ -5,6 +5,21 @@
<link rel="stylesheet" type="text/css" href="css/dejavu.css">
<link id="page_style" rel="stylesheet"
type="text/css" href="css/default.css">
<style>
.k12-frame {
height: 100%;
width: 70px;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: rgba(255, 0, 0, 0.2);
overflow-x: hidden;
}
svg {
margin-left: 70px;
}
</style>
<title></title>
</head>
<body class="patch_body">
......@@ -26,6 +41,12 @@
<input style="display:none;" id="savepanel_dialog" type="file"
nwsaveas nwworkingdir />
</span>
<div class="k12-frame">
<button
title="this is a reverb button"
onclick="pdgui.pdsend(canvas_events.get_id() + ' dirty 1');
pdgui.pdsend(canvas_events.get_id() + ' obj_abstraction K12/fx_reverb 0 20');">reverb</button>
</div>
<svg xmlns="http://www.w3.org/2000/svg"
version="1.1"
id="patchsvg"
......
......@@ -50,6 +50,7 @@ var canvas_events = (function() {
last_dropdown_menu_y,
last_search_term = "",
svg_view = document.getElementById("patchsvg").viewBox.baseVal,
k12_offset = -70,
textbox = function () {
return document.getElementById("new_object_textentry");
},
......@@ -224,7 +225,7 @@ var canvas_events = (function() {
//pdgui.post("x: " + evt.pageX + " y: " + evt.pageY +
// " modifier: " + (evt.shiftKey + (pdgui.cmd_or_ctrl_key(evt) << 1)));
pdgui.pdsend(name, "motion",
(evt.pageX + svg_view.x),
(evt.pageX + svg_view.x + k12_offset),
(evt.pageY + svg_view.y),
(evt.shiftKey + (pdgui.cmd_or_ctrl_key(evt) << 1))
);
......@@ -245,7 +246,7 @@ var canvas_events = (function() {
// get id ("x123456etcgobj" without the "x" or "gobj")
target_id = (draggable_label ? "_l" : "_s") +
evt.target.parentNode.parentNode.id.slice(0,-4).slice(1);
last_draggable_x = evt.pageX + svg_view.x;
last_draggable_x = evt.pageX + svg_view.x + k12_offset;
last_draggable_y = evt.pageY + svg_view.y;
// Nasty-- we have to forward magic values from g_canvas.h
......@@ -271,7 +272,7 @@ var canvas_events = (function() {
!!draggable_label, false);
pdgui.pdsend(target_id, "_click", resize_type,
(evt.pageX + svg_view.x),
(evt.pageX + svg_view.x + k12_offset),
(evt.pageY + svg_view.y));
canvas_events.iemgui_label_drag();
return;
......@@ -302,7 +303,7 @@ var canvas_events = (function() {
mod = (evt.shiftKey + (pdgui.cmd_or_ctrl_key(evt) << 1));
}
pdgui.pdsend(name, "mouse",
(evt.pageX + svg_view.x),
(evt.pageX + svg_view.x + k12_offset),
(evt.pageY + svg_view.y),
b, mod
);
......@@ -314,7 +315,7 @@ var canvas_events = (function() {
// evt.pageX + " y: " + evt.pageY +
// " button: " + (evt.button + 1));
pdgui.pdsend(name, "mouseup",
(evt.pageX + svg_view.x),
(evt.pageX + svg_view.x + k12_offset),
(evt.pageY + svg_view.y),
(evt.button + 1)
);
......@@ -481,7 +482,7 @@ var canvas_events = (function() {
// handle (which will eventually get erased by Pd anyway).
// Anyhow, this is all very bad, but it works so it's
// at least not the worst of all possible worlds.
var dx = (evt.pageX + svg_view.x) - last_draggable_x,
var dx = (evt.pageX + svg_view.x + k12_offset) - last_draggable_x,
dy = (evt.pageY + svg_view.y) - last_draggable_y,
handle_elem = document.querySelector(
draggable_label ?
......@@ -494,11 +495,11 @@ var canvas_events = (function() {
getElementsByClassName("gop_drag_handle").length ?
true : false;
last_draggable_x = evt.pageX + svg_view.x;
last_draggable_x = evt.pageX + svg_view.x + k12_offset;
last_draggable_y = evt.pageY + svg_view.y;
pdgui.pdsend(target_id, "_motion",
(evt.pageX + svg_view.x),
(evt.pageX + svg_view.x + k12_offset),
(evt.pageY + svg_view.y));
},
iemgui_label_mouseup: function(evt) {
......
......@@ -4650,6 +4650,8 @@ function gui_canvas_popup(cid, xpos, ypos, canprop, canopen, isobject) {
xpos -= Math.floor(svg_view_box[0] * zfactor);
ypos -= Math.floor(svg_view_box[1] * zfactor);
xpos += 70;
popup_coords[2] = xpos + nw_win.x;
popup_coords[3] = ypos + nw_win.y;
......@@ -5128,7 +5130,7 @@ function gui_dropdown_activate(cid, obj_tag, tag, current_index, font_size, stat
// set a max-height to force scrollbar if needed
select_elem.style.setProperty("max-height", div_max + "px");
select_elem.style.setProperty("left",
(elem_get_coords(g).x - svg_view.x) + "px");
(elem_get_coords(g).x - svg_view.x + 70) + "px");
// Remove "top" and "bottom" props to keep state clean
select_elem.style.removeProperty("top");
select_elem.style.removeProperty("bottom");
......@@ -5566,7 +5568,7 @@ function gui_textarea(cid, tag, type, x, y, width_spec, height_spec, text,
.viewBox.baseVal;
p.classList.add(type);
p.contentEditable = "true";
p.style.setProperty("left", (x - svg_view.x) + "px");
p.style.setProperty("left", (x - svg_view.x) + 70 + "px");
p.style.setProperty("top", (y - svg_view.y) + "px");
p.style.setProperty("font-size",
pd_fontsize_to_gui_fontsize(font_size) + "px");
......@@ -5658,7 +5660,7 @@ function canvas_params(nw_win)
// the scrollbars from appearing. Here, we just subtract 4 from both
// of them. This could lead to some problems with event handlers but I
// haven't had a problem with it yet.
min_width = nw_win.window.innerWidth - 4;
min_width = nw_win.window.innerWidth - 88;
min_height = nw_win.window.innerHeight - 4;
// Since we don't do any transformations on the patchsvg,
// let's try just using ints for the height/width/viewBox
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment